[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] File conversion script problem



At 12.20 -0500 1999.02.01, Ero Brown wrote:
>1) Please let me know if you know of a better script to do
>   this sort of thing.

Oh yeah.  Untested code here, so try before you buy.  Note that each one of
these is a separate script.

Basically, each function is a one-line script.  You're killing yourself.

#!perl -i.bak
# lf2cr (Unix or DOS to Mac)
$/ = "\012";
while (<>) {
    s/\015?\012/\015/g;
    print;
}


#!perl -i.bak
# lf2crlf (Unix to DOS)
$/ = "\012";
while (<>) {
    s/\015?\012/\015\012/g;
    print;
}


#!perl -i.bak
# cr2lf (Mac to Unix)
while (<>) {
    s/\015/\012/g;
    print;
}


#!perl -i.bak
# cr2crlf (Mac to DOS)
while (<>) {
    s/\015/\015\012/g;
    print;
}


#!perl -i.bak
# crlf2lf (DOS to Unix)
while(<>) {
    s/\015?\012/\012/g;
    print;
}

--
Chris Nandor          mailto:pudge@pobox.com         http://pudge.net/
%PGPKey = ('B76E72AD', [1024, '0824090B CE73CA10  1FF77F13 8180B6B6'])

***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch