Negating awk command
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???