Register
It is currently Tue Jul 29, 2014 2:42 am

Using grep with hyphens


All times are UTC - 6 hours


Post new topic Reply to topic  [ 2 posts ] 
Author Message
 PostPosted: Thu Jan 31, 2013 11:34 am   

Joined: Mon Apr 27, 2009 2:24 pm
Posts: 10
This is on a RHEL 6 box with bash 4.1.2

I'm trying to to use grep to only find those lines containing matches that form whole words.

The -w option works fantastic unless of course that word has a hyphen.

The problem is I will get a hit on "test-group" which is a good thing, but I will also get a hist on "test" which is bad because the group test doesn't exist. It appears that once grep hits a hyphen it treats the preceding text as a whole word.

Any ideas would be greatly appreciated.

Next time no groups with hyphens..

Thanks


Top
 Profile  
 PostPosted: Thu Jan 31, 2013 12:17 pm   

Joined: Mon Mar 02, 2009 3:03 am
Posts: 533
hi

as a lot of unix command, grep has -- to tell options are finished


Top
 Profile  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: Bing [Bot] and 7 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
cron


BashScripts | Promote Your Page Too
Powered by phpBB © 2011 phpBB Group
© 2003 - 2011 USA LINUX USERS GROUP