[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Converting Msdos files to UNIX
- To: <misc@openbsd.org>
- Subject: Re: Converting Msdos files to UNIX
- From: "OpenBSD User" <openbsd_user@hotmail.com>
- Date: Thu, 1 May 2003 04:01:50 -0400
- References: <D367261D-7B1E-11D7-B476-0003939CC61E@yonderway.com> <200304301152.31409.scolson@westpole.com> <Pine.BSO.4.53.0304301625250.456@n1.BOFH.bsddeveloper.co.uk> <200304301307.15250.scolson@westpole.com>
perl -p -e 's/\r\n/\n/;' < input_filename > output_filename
Note that I've sometimes seen a ^Z at the end of dos text files.
todos/fromdos or unix2dos/dos2unix utilities are probably the best choice.
----- Original Message -----
From: "Stephen Colson" <scolson@westpole.com>
To: "Thorsten Glaser" <tg-2003m@netcologne.de>
Cc: <misc@openbsd.org>
Sent: Wednesday, April 30, 2003 9:07 AM
Subject: Re: Converting Msdos files to UNIX
> In the body of his email, he asked about ^M, so I gave him what he asked
for.
> Yes, *nix uses LF, Mac's use CR, and Dos uses CRLF. I gave him something
that
> would replace the ^M in question with a new line. If he wants to straight
out
> delete them, he can use:
> tr -d "^M" <input >output
>
> or as you suggested:
> tr -d '\r' <input >output
>
> In any event, it would not be specifically Mac->*nix, but rather CR -> LF
> which in this case (dos->*nix) will yield CRLF -> LFLF therby giving
multiple
> line breaks. The basis is still there--use tr.
>
> -s
>
>
> On Wednesday 30 April 2003 04:26 pm, Thorsten Glaser wrote:
> > begin electrogrammati illius Stephen Colson
> >
> > >"[\012*]" is to replace ^M with the standard *nix newline char.
> >
> > Uhm, he wanted DOS->UNIX® and not Macintosh->UNIX®
> >
> > DOS uses CR+LF as newline, as per ISO 646
> > UNIX® uses LF as newline, as per ISO 9899
> > Macintoshen use CR as newline. Well, they did when I
> > last heard of them.
> >
> > //Thorsten