Date: Tue, 24 Sep 1996 09:51:47 +0200 From: kuku@gilberto.physik.rwth-aachen.de (Christoph P. Kukulies) To: Carey.Nairn@its.utas.edu.au Cc: randyd@nconnect.net (Randall D. DuCharme), questions@freebsd.org Subject: Re: MS-DOS text files in UNIX Message-ID: <199609240751.JAA04894@gilberto.physik.rwth-aachen.de> In-Reply-To: <Pine.SOL.3.91.960924162534.7851E-100000@wedge.its.utas.edu.au>; from Carey Nairn on Sep 24, 1996 16:26:30 %2B1000 References: <Pine.SOL.3.91.960924162534.7851E-100000@wedge.its.utas.edu.au>
next in thread | previous in thread | raw e-mail | index | archive | help
Carey Nairn writes:
> On Mon, 23 Sep 1996, Randall D. DuCharme wrote:
>
> > Greetings,
> > I've read numerous things about adding the CR-LF back into text files
> > for use with DOS, but what about the other way?? Is there a way to
> > remove
> > that annoying ^M from a DOS text file under FBSD? I've tried many
> > things
> > but nothing short of removing them one-by-one seems to work.
> >
> > Thanks
> >
> > Randy
> >
>
> How about this little perl script
>
> -------------------------------------------------------------
> #!/usr/local/bin/perl -ni
>
> if (/\r$/) {
>
> chop; chop;
> print $_,"\n";
> }
> else
> {
>
> print $_;
> print (STDERR "$ARGV[0]: Line does not need translation\n");
> }
> -------------------------------------------------------------
>
> Cheers,
> Carey
>
> =========================================================================
> Carey Nairn ! email : Carey.Nairn@its.utas.edu.au
> Infrastructure Services ! phone : (03) 6226 7419
> Information Technology Services ! fax : (03) 6226 7898
> University of Tasmania. ! int'l : (+61 3)
> =========================================================================
>
>
>
Not so fancy but straight:
tr -d "\015" <input >output
Under vi I sometimes do
:%s/^V^M//g
(^V is control-V, ^M is control-M or RETURN)
--
--Chris Christoph P. U. Kukulies kuku@gil.physik.rwth-aachen.de
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199609240751.JAA04894>
