TCLUG Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [TCLUG:10735] FromDOS?



Troy Johnson wrote:
 
> Excuse me please! My brain does not seem to be connected this evening.
> Here are scripts that seem to work.
> 
> ------------------------
> #!/usr/bin/perl -w
> # unix2dos
> while (<>) {
>         s/\n/\r\n/g;
>         print;
> }
> ------------------------
> #!/usr/bin/perl -w
> # dos2unix
> while (<>) {
>         s/\r//g;
>         print;
> }
> ------------------------

Heh, after banging my head for a while, it looks like the files I had
may have been from a mac (or something), so my script ended up looking
like

#!/usr/bin/perl -w
while (<>) {
        s/\r/\n/g;
        print; 
}

-- 
 _  _  _  _ _  ___    _ _  _  ___ _ _  __   Flirt: A woman who thinks 
/ \/ \(_)| ' // ._\  / - \(_)/ ./| ' /(__   it's every man for  
\_||_/|_||_|_\\___/  \_-_/|_|\__\|_|_\ __)  herself. 
 [ Mike Hicks | http://umn.edu/~hick0088/ | mailto:hick0088@umn.edu ]