in reply to Re: Remove newlines and join lines
in thread Remove newlines and join lines
Effectively what you want to do is remove any blank lines and then join every second remaining to it's predecessor. So... (untested)
#open INPUT and OUTPUT while (<INPUT>) { chomp; next if m/^\s+$/; my $nextline; chomp($nextline = <INPUT> ) while $nextline !~ m/^\s+/; print OUTPUT $_,' ',$nextline; } #close INPUT and OUTPUT
|
|---|