in reply to Unix vs Windows Text File Format

Purely out of interest, does this do the job?

perl -l0 -0015 -pe1 infile >outfile

Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
RIP an inspiration; A true Folk's Guy

Replies are listed 'Best First'.
Re^2: Unix vs Windows Text File Format
by sgt (Deacon) on Aug 05, 2010 at 22:14 UTC

    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

      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