![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| search two words in sed | ajitkumar2 | Shell Programming and Scripting | 12 | 08-01-2008 12:00 AM |
| grep on multiple words to match text template | rider29 | Shell Programming and Scripting | 6 | 05-23-2008 08:21 AM |
| problem with grep on search string in a txt file over multiple files | m00 | UNIX for Dummies Questions & Answers | 2 | 05-18-2008 11:21 AM |
| grep with find to search for matchiing words | akhil313 | UNIX for Dummies Questions & Answers | 1 | 12-12-2006 07:18 AM |
| multiple search with grep | amon | Shell Programming and Scripting | 5 | 04-04-2006 03:53 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#8
|
|||
|
|||
|
for FILE in `ls -1 *.log`
do w1=`cat $FILE|grep -c "word1"` w2=`cat $FILE|grep -c "word2"` if [ ${w1} -gt 0 -a ${w2} -gt 0 ] then echo "$FILE" fi done |
| Forum Sponsor | ||
|
|
|
#9
|
||||
|
||||
|
try...
egrep -l "word[1-2]" * or egrep -l "word1|word2" * |
|
#10
|
|||
|
|||
|
for FILE in `ls -1 *.log`
do w1=`cat $FILE|grep -c "word1"` w2=`cat $FILE|grep -c "word2"` if [ ${w1} -gt 0 -a ${w2} -gt 0 ] then echo "$FILE" fi done |
|
#11
|
|||
|
|||
|
Hi Palsevlohit
Thank U very much yaar ,its working fine............. i have one more dout, is is possible to do using grep or find.......... |
|
#12
|
||||
|
||||
|
i don't think you need a script for it...
|
|
#13
|
|||
|
|||
|
Hi vidya
egrep -l "word1|word2" * i have tried this one but its given all file names....its working like or command but i want files that should be word1 and word2 , the above script working fine but if possible could you please send unix command.... |
|
#14
|
||||
|
||||
|
try this....
Quote:
|
||||
| Google The UNIX and Linux Forums |