Hi All,
I want to search all the ksh scripts that has following details.
- Search for "exit 0"
- Search for "sqlldr" or sqlplus"
- In the above files i want to search for all the script that has no "case" in it.
Please advice.
Thanks,
Deep
Hi All,
I want to search all the ksh scripts that has following details.
Please advice.
Thanks,
Deep
Try this:
grep -l 'exit 0' *.ksh | xargs grep -El 'sql(ldr|plus)' | while read file
do
grep -q case $file || echo $file
done
Or this:
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
Thanks a lot Annihilannic.
I will test this.
Regards,
Deepak