From owner-freebsd-questions Tue Sep 24 00:50:11 1996 Return-Path: owner-questions Received: (from root@localhost) by freefall.freebsd.org (8.7.5/8.7.3) id AAA03205 for questions-outgoing; Tue, 24 Sep 1996 00:50:11 -0700 (PDT) Received: from Campino.Informatik.RWTH-Aachen.DE (campino.Informatik.RWTH-Aachen.DE [137.226.225.2]) by freefall.freebsd.org (8.7.5/8.7.3) with SMTP id AAA03183 for ; Tue, 24 Sep 1996 00:50:07 -0700 (PDT) Received: from gilberto.physik.rwth-aachen.de (gilberto.physik.rwth-aachen.de [137.226.31.2]) by Campino.Informatik.RWTH-Aachen.DE (RBI-Z-5/8.6.12) with ESMTP id JAA00267; Tue, 24 Sep 1996 09:45:10 +0200 Received: (from kuku@localhost) by gilberto.physik.rwth-aachen.de (8.6.11/8.6.9) id JAA04894; Tue, 24 Sep 1996 09:51:49 +0200 Message-Id: <199609240751.JAA04894@gilberto.physik.rwth-aachen.de> 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 In-Reply-To: ; from Carey Nairn on Sep 24, 1996 16:26:30 +1000 References: X-Mailer: Mutt 0.44 Mime-Version: 1.0 Sender: owner-questions@freebsd.org X-Loop: FreeBSD.org Precedence: bulk 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" 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