http://qs321.pair.com?node_id=853260


in reply to Re: Unix vs Windows Text File Format
in thread Unix vs Windows Text File Format

You probably meant:

% perl -0015 -pe chomp infile > outfile # or even better % perl -0015 -pe 's{^\cZ$}{}; chomp' infile > outfile # deparse shows that -l0 cannot work % stephan@ape (/c/cygvar/tmp) % % perl -MO=Deparse -l0 -0015 -pe1 BEGIN { $/ = "\r"; $\ = "\000"; } LINE: while (defined($_ = <ARGV>)) { chomp $_; '???'; } continue { print $_; } -e syntax OK # checking % stephan@ape (/c/cygvar/tmp) % % echo abc def | xargs -n1 | perl -lpe '$_.="\cM"' | cat -evnt 1 abc^M$ 2 def^M$ % stephan@ape (/c/cygvar/tmp) % % echo abc def | xargs -n1 | perl -lpe '$_.="\cM"' | perl -0015 -pe ch +omp | cat -evnt 1 abc$ 2 def$
cheers --steph

Replies are listed 'Best First'.
Re^3: Unix vs Windows Text File Format
by BrowserUk (Patriarch) on Aug 05, 2010 at 23:08 UTC
    You probably meant

    No. I meant what I posted, but as I indicated, I wasn't sure if it would work. Kinda hard to test without a working *nix environment and my VirtualBox/Ubunto is currently screwed. I hadn't thought of using Deparse.

    That said: this should work:

    perl -0777 -l -0015 -pe1 in >out