How can I use awk to modify lines that match a certain pattern, but only if the NEXT line does not match another pattern?
For example take this fragment:
....
pattern1 100 200 300
pattern1 300 400 400
pattern2 300 900 700
pattern1 200 500 900
...
I would like to modify all lines containing pattern1
, except for the second one which is followed by a line containing pattern2
.
This is similar to this question, but just the other way around.