We don't bite newbies here... much | |
PerlMonks |
Re^2: how to use matching operator on newlinesby extremely (Priest) |
on Jan 03, 2007 at 21:19 UTC ( [id://592834]=note: print w/replies, xml ) | Need Help?? |
One option to avoid slurping and would be to set $/ to the double return:
perl -i -pe 'BEGIN{$/="\n\n"} s/\n\n/\n/;' foo.txt Another option would be to set $/ and $\ (Yay, output format!) and chomp it: perl -i -pe 'BEGIN{$/="\n\n";$\="\n"} chomp;' foo.txt -i added back in per kyle's post. Also, ++ to ikegami, too! --
In Section
Seekers of Perl Wisdom
|
|