When all is sed and doneWill Hollandhttp://yakking.branchable.com/posts/sed/yakkingikiwiki2016-04-30T17:12:44ZPrint line before match with SED - not hard ...http://yakking.branchable.com/posts/sed/comment_1_78cc812b4908060874937efa077249b5/MartinMSPedersen2016-04-30T17:12:44Z2016-04-30T17:12:44Z
<p>It is not a problem with SED to print a previous line if the current line match something.
You just copy the pattern space (current line) into the Hold Space area.
If there is a match, you can copy the Hold Space back into the pattern space.</p>
<p>eg.</p>
<p>sed -n ' /MATCH/ { g ; p } ; h '</p>