Exit an awk script without processing

December 8, 2011 at 11:24:24
Specs: AIX 5.3, 4 CPU / 32 GB RAM
Hello,

I have an awk script which I'd like to exit if it finds a keyword, if not continue processing.

BEGIN {
var1="abc..."
var2="xyz..."
}

{

if(/MAYDAY/) { print "Exiting!"; exit }
else {
continue processing
}
}


The problem is even when I find "MAYDAY" I still get some line being printed. Could anyone assist?

Thanks


See More: Exit an awk script without processing

Report •

#1
December 8, 2011 at 14:17:39
Just grep for the keyword before starting your awk script. If you don't find your "MAYDAY," run your awk script.

How To Ask Questions The Smart Way


Report •
Related Solutions


Ask Question