in reply to Re: Removing double carriage return
in thread Removing double carriage return
My updated code that seems to work. Thanks again pvaldes for your help!
pvaldes' code:Mine:while (<>) { next if $_ =~ m/\n{1}/; if ($_ =~ m/\n{2}){s/\n{2}/\n/gs} elsif ($_ =~ m/\n{3,}){s/\n{3,}/\n\s/gs} }
while (<>) { if ($_ =~ m/\n{1}/) { } if ($_ =~ m/\n{2}/){ s/\n{2}/\n/gs; print; } elsif ($_ =~ m/\n{3,}/){ s/\n{3,}/\n/gs; print; } }
while (<>) { if ($_ =~ m/\S\n{2}\S/){ s/(\S)\n{2}(\S)/$1\n$2/gs; print; } elsif ($_ =~ m/\n{3,}/){ s/\n{3,}/\n\n/gs; print; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Removing double carriage return
by Cristoforo (Curate) on Aug 23, 2011 at 04:58 UTC | |
by dragooneye (Novice) on Aug 26, 2011 at 17:29 UTC | |
|
Re^3: Removing double carriage return
by pvaldes (Chaplain) on Aug 22, 2011 at 20:31 UTC |