multiline sed

Given you have a PostScript file that contains blocks like the following, but with different commands repeatedly:

gsave
/Courier findfont 10 scalefont ISOEncode setfont
0.000 0.000 0.000 setrgbcolor AdjustColor
202 2.8421709430404e-14 [
[(0.4)]
] 12 -0.5 1 0 false DrawText
or

gsave
/Helvetica findfont 10 scalefont ISOEncode setfont
0.000 0.000 0.000 setrgbcolor AdjustColor
10 240 [
[(File: file1.wav   Page: 1 of 3   Printed: Fri Feb 19 18:32:26)]
] 14 -0 0 0 false DrawText
grestore

and you want to remove those blocks that match '(File' in the fifth line of input, you could try this: sed -e '/gsave/ { N; N; N; N; /(File/ { N; N; d; } }'

0 Kommentare:

Kommentar veröffentlichen