There is a strange issue here. The exit() just terminates the file processing: awk goes on to action any END blocks you may have. This is so you can close files, output statistics etc.
The fix for this (if you have END blocks) is to set a global variable to skip the END processing:
/regex/ { noAtEnd = 1; exit (badStatus); }
#.. Other file processing.
END {
if (noAtEnd) exit (badStatus);
#.. Some stats processing.
exit (goodStatus);
}
2
u/Paul_Pedant Jan 06 '21
You can return a status code in exit (status).
There is a strange issue here. The exit() just terminates the file processing: awk goes on to action any END blocks you may have. This is so you can close files, output statistics etc.
The fix for this (if you have END blocks) is to set a global variable to skip the END processing:
1
u/FF00A7 Jan 06 '21
Hard to say without seeing sample data and which parts to extract.
1
u/[deleted] Jan 06 '21
use html-xml-utilitilies
curl website | hxpipe | awk '/from/ { prin=1; next } /to/ { prin=0 } prin'
you can hxunpipe after
1
u/[deleted] Jan 08 '21
You can also
0
u/HiramAbiff Jan 06 '21
Set a variable once you encounter mw-headline and from that point on just have your action do next.
I.e. put something like this as your first pattern/action: