Print lines between two patterns , the awk way ...
Post first published in nixtip
Example input file:
The standard way ..
Self-explained indented code:
The first optimization is to get rid of the print , in
awk when a condition is true
print is the default action , so when the flag is true the line is going to be echoed.
To delete de
NEXT statement , in order o prevent printing the TAG line, we need to activate the flag after the
OUTPUT pattern discovery and after the flag evaluation.
A slight variation of the program flow and we’re done:
PD: What if we only want to print the lines enclosed between the
comments powered by
END tags ?