You're replying to a comment by Peter Krumins.

October 28, 2011, 08:27

Here is how:

awk -vp=1 '/ABC/,/DEF/ { p=0; if (/ABC/ || /DEF/) p=1 } p'

The -vp=1 sets variable p (p for print) to 1 before the awk script starts.

If the range /ABC/,/DEF/ is matched, then set p to 0 (don't print). However if it's the /ABC/ or /DEF/, then set p to 1 (print).

Then evaluate p. If it's true, awk prints the current line.

Reply To This Comment

(why do I need your e-mail?)

(Your twitter handle, if you have one.)

Type the word "unix_257": (just to make sure you're a human)

Please preview the comment before submitting to make sure it's OK.