- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Grep qustion
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-13-2003 07:14 AM
01-13-2003 07:14 AM
Grep qustion
I have a file whit 3 names inside, mmarano smmarano mmarano1.
I must find only mmarano, not smmarano and mmarano1.
I use grep to serch, but I see all the names, I try whit grep "^mmarano$", but this command not function.
I'm sure that somebody can help me.....I hope.
Thenks
Manuel
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-13-2003 07:05 AM
01-13-2003 07:05 AM
Re: Grep qustion
James F.'s method should work.
Hai
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-13-2003 07:11 AM
01-13-2003 07:11 AM
Re: Grep qustion
This is clearer:
# grep mmarano filename| grep -v smmarano|grep -v mmarano1
That is,
The 'grep -x mmarano' form suggested above and the regular expression ^mmarano$ accomplish the same thing -- they assume that the entire input line matches the string or regular expression.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-13-2003 07:18 AM
01-13-2003 07:18 AM
Re: Grep qustion
# grep mmarano file
ore
# cat file | grep mmarano
Robert-Jan.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-13-2003 07:18 AM
01-13-2003 07:18 AM
Re: Grep qustion
2. use word bounds in regex engines that support it (why do I always think in perlish styles ? :)
# perl -ne'/\bmmarano\b/ or print' datafile
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-13-2003 07:18 AM
01-13-2003 07:18 AM
Re: Grep qustion
cat
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-13-2003 07:19 AM
01-13-2003 07:19 AM
Re: Grep qustion
Try grep -x mmarano.
Pete
Pete
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-13-2003 07:19 AM
01-13-2003 07:19 AM
Re: Grep qustion
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-13-2003 07:21 AM
01-13-2003 07:21 AM
Re: Grep qustion
no i was typing cat file | grep "^mmarano$"
that works for me.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-13-2003 07:24 AM
01-13-2003 07:24 AM
Re: Grep qustion
Me, too.
Pete
Pete
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-13-2003 07:25 AM
01-13-2003 07:25 AM
Re: Grep qustion
Here's one simple way"
# cat /tmp/grep|grep mmarano|grep -v smmarano|grep -v mmarano1
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-13-2003 07:28 AM
01-13-2003 07:28 AM
Re: Grep qustion
-w, --word-regexp force PATTERN to match only whole words
# grep -w mmarano infile
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-13-2003 07:45 AM
01-13-2003 07:45 AM
Re: Grep qustion
live free or die
harry
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-13-2003 07:50 AM
01-13-2003 07:50 AM
Re: Grep qustion
Use -x (eXact) option, this Matches are recognized only when the entire input line matches the fixed string or regular expression.
grep -x mmarano file
Of course, to do this between "mmarano" must exist al least blank spaces that limit the name like a one word.
I've tried with "grep ^mmarano file" and works fine!
If you have an inmediate charater delimiting mmarano name, you will use it into the match string, i.e. if you have a ":" character after "mmarano" string, you can specify exactly by: "grep mmarano: file"
Rgds.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-13-2003 09:01 PM
01-13-2003 09:01 PM