![]() |
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 |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| To find multiple strings count in a file | salaathi | Linux | 3 | 11-28-2007 06:31 AM |
| Search for strings & copy to new file | amitrajvarma | Shell Programming and Scripting | 2 | 11-25-2007 11:51 PM |
| Problem to search multiple strings | sudhish | Shell Programming and Scripting | 2 | 10-25-2007 02:00 PM |
| string search in folders with particular multiple file extension | anikanch | UNIX for Dummies Questions & Answers | 2 | 10-28-2005 10:09 AM |
| searching for filenames with search strings in another file | pathanjalireddy | Shell Programming and Scripting | 3 | 06-08-2005 05:35 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
How to search multiple strings in a file
Hi All,
I want to search all the ksh scripts that has following details. 1. Search for "exit 0" 2. Search for "sqlldr" or sqlplus" 3. In the above files i want to search for all the script that has no "case" in it. Please advice. Thanks, Deep |
|
||||
|
Try this:
Code:
grep -l 'exit 0' *.ksh | xargs grep -El 'sql(ldr|plus)' | while read file
do
grep -q case $file || echo $file
done
Code:
for f in *.ksh
do
awk '/exit 0/ {e=1} /sql(ldr|plus)/ { s=1 } /case/ { c=1 } END { if (e && s && !c) { print FILENAME } }' $f
done
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|