in reply to Re^2: replace multiple newline characters
in thread replace multiple newline characters
Even shorter :-) (Update: Sorry, not quite the same, see replies.)
$ perl -lp000e1 input.txt >output.txt
$ perl -MO=Deparse -lp000e1 BEGIN { $/ = ""; $\ = "\n"; } LINE: while (defined($_ = readline ARGV)) { chomp $_; '???'; } continue { die "-p destination: $!\n" unless print $_; }
Or edited:
use warnings; use strict; local ($/,$\) = ("","\n"); while (<>) { chomp; print; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: replace multiple newline characters
by hippo (Archbishop) on May 15, 2018 at 09:59 UTC | |
by haukex (Archbishop) on May 15, 2018 at 10:07 UTC |