in reply to How to print a matching line and one line above it?
As a slightly unweildy one-liner:
perl -ne"if(/processed/){ print($last),undef($last) if $last; print;}else{$ +last=$_}" junk.dat **start xyz File1 processed File2 processed **start wert File3 processed File4 processed
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: How to print a matching line and one line above it?
by vbynagari (Initiate) on Apr 20, 2011 at 00:43 UTC | |
by BrowserUk (Patriarch) on Apr 20, 2011 at 00:56 UTC |