![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | 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 here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Grep Three Words | murbina | UNIX for Dummies Questions & Answers | 12 | 08-14-2008 12:38 AM |
| grep on multiple words to match text template | rider29 | Shell Programming and Scripting | 6 | 05-23-2008 08:21 AM |
| How to extract two words at the same time. | Aejaz | UNIX for Advanced & Expert Users | 6 | 04-30-2008 06:09 AM |
| grep with find to search for matchiing words | akhil313 | UNIX for Dummies Questions & Answers | 1 | 12-12-2006 06:18 AM |
| find words with grep.... | chrisxgr | Shell Programming and Scripting | 8 | 04-06-2006 10:25 PM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
|||
|
How to grep for two or more words in a line at the same time?
I want to search a heap of files but using an either OR or AND condition for two or more strings. How can I do this?
i.e. file1 has the following file testfile primary and file2 has this ... file testfile2 secondary If I use this ... find . -type f -exec grep "testfile" {} /dev/null \; I get BOTH files. However, I want to use something that will give me the 1st file if I say something like ... find . -type f -exec grep "file&&testfile" {} /dev/null \; This actually did not work under C shell or Korn shell. I also tried egrep "file&&testfile" and it too did not work. In VMS (here we go! hehehe)... it was so easy ... search *.src file, testfile /match=and Thanks in advance |
| Forum Sponsor | ||
|
|