Doesn't that double print lines matching following /pattern/?
Perhaps you meant something like ...
perl -pi.bak -e '/^pattern$/ && <>' a_text_file.txt
...where the <> eats up the next line before it gets assigned to $_ and printed by the -p switch.
Update: s/matching/following/;, but it took me a while to figure out why. Neat trick!++ :)
--k.
In reply to Re: Re: match and then delete next line
by Kanji
in thread match and then delete next line
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |