Skip to Main Content

Infrastructure Software

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Negating awk command

807567Jun 25 2001
I would like to find out how to negate my nawk command.

This pulls all files with <TITLE> in the file:
#!/bin/ksh
find . \( -name "*.htm" -o -name "*.html" \) -print |
xargs awk '/<TITLE>/ {printf("%s\t%s\n", FILENAME, $0)}'

OUTPUT:
./fir.html <TITLE> fir title </TITLE>
./tr.html <TITLE> third title </TITLE>
./four.html <TITLE> four title </TITLE>


I tried several ways to pull up files with no <TITLE> in the file:
#!/bin/ksh
find . \( -name "*.htm" -o -name "*.html" \) -print |
xargs awk '!/<TITLE>/ {printf("%s\t%s\n", FILENAME, $0)}'

and tried this with no luck:

#!/bin/ksh
find . \( -name "*.htm" -o -name "*.html" \) -print |
xargs awk '$2 !~ /<TITLE>/ {printf("%s\t%s\n", FILENAME, $0)}'

Both did not work.
Any suggestions???
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 23 2001
Added on Jun 25 2001
0 comments
109 views