![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Advanced & Expert Users Expert-to-Expert. Learn advanced UNIX, UNIX commands, Linux, Operating Systems, System Administration, Programming, Shell, Shell Scripts, Solaris, Linux, HP-UX, AIX, OS X, BSD. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| AWK: Multiple patterns per line | Plavixo | UNIX for Dummies Questions & Answers | 1 | 05-05-2008 04:31 PM |
| How to get lines in between Patterns? | racbern | Shell Programming and Scripting | 11 | 04-23-2008 07:28 AM |
| Perl: Match a line with multiple search patterns | Juha | Shell Programming and Scripting | 10 | 04-09-2008 01:43 AM |
| get the value between 2 patterns | minifish | Shell Programming and Scripting | 11 | 04-07-2008 02:18 PM |
| searching for two or more patterns in a line | metalwarrior | UNIX for Dummies Questions & Answers | 4 | 02-05-2008 01:01 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
3 patterns in one line
hello, I want to write a script to find all the files that contain 3 specific patterns. example: shows the files containing any line that contain pattern1, pattern2 and pattern3, but the patterns can be in any order as long as they exist in the line.
can I do that with grep? thank you |
|
||||
|
Under any Unix or Linux, to find...:
- by searching from /your_start_dir directory - all files with .txt extension - also by following symbolic links, if any - for each such file, execute a regular expression search with : - _Extended grep - _list only file names (without -l, will also print found lines) - do the search case _insensitive - search pattern pat1 or pat2 or pat3 type this command: find /your_start_dir -name '*.txt' -follow -exec grep -E -l -i 'pat1|pat2|pat3' {} \; |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|