|
|||||||
| Forums | Search Forums | Register | Forum Rules | Man Pages | Albums | FAQ | Members | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
|
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
grep for more than one pattern
I want to grep for more than one pattern in a file...
ie.. grep for root and nobody in /etc/passwd file and then count the occurances.. Ideally I would want to do this but I know it doesnt work grep -c root nobody /etc/passwd Any ideas? |
| Sponsored Links | ||
|
|
#2
|
|||
|
|||
|
look at -e option with grep
|
| Sponsored Links | ||
|
|
#3
|
|||
|
|||
|
I did - but have not been able to figure out how to use it - can you help?
Give an example etc? |
|
#4
|
|||
|
|||
|
grep -ce "root" -e "nobody" /etc/passwd
bakunin |
| Sponsored Links | |
|
|
#5
|
|||
|
|||
|
Excellent - thank you very much!
![]() |
| Sponsored Links | ||
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How to grep pattern | alok.behria | UNIX for Dummies Questions & Answers | 2 | 05-05-2011 01:34 PM |
| Want to grep for a pattern and display the content above that pattern | ajayakunuri | Shell Programming and Scripting | 6 | 06-25-2010 06:48 AM |
| grep for pattern | aemunathan | Shell Programming and Scripting | 12 | 05-09-2008 02:58 AM |
| How to grep this pattern?? | askumarece | Shell Programming and Scripting | 13 | 02-20-2008 06:03 AM |
| help with grep the pattern | bluemoon1 | Shell Programming and Scripting | 2 | 09-20-2007 11:27 AM |
|
|