in reply to perl one line for advanced grep (current line and next one)
I normally don't do one-liners, so I thought I'd play with it a bit. Here's my shot at it:
perl -ne '$fl=$.+2 if /regex/; print if $fl>$.' testfileUpdate: here's another:
perl -ne 'print $t,$_ if $t=~/regex/; $t=$_' testfileUpdate: ...but the second one is broken, as kschwab mentions...
...roboticus
When your only tool is a hammer, all problems look like your thumb.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: perl one line for advanced grep (current line and next one)
by kschwab (Vicar) on Sep 02, 2013 at 17:32 UTC |