Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 24 Sep 1996 16:26:30 +1000 (EST)
From:      Carey Nairn <cp_nairn@cc.utas.edu.au>
To:        "Randall D. DuCharme" <randyd@nconnect.net>
Cc:        questions@FreeBSD.org
Subject:   Re: MS-DOS text files in UNIX
Message-ID:  <Pine.SOL.3.91.960924162534.7851E-100000@wedge.its.utas.edu.au>
In-Reply-To: <324754C2.41C67EA6@nconnect.net>

next in thread | previous in thread | raw e-mail | index | archive | help
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)
=========================================================================






Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.SOL.3.91.960924162534.7851E-100000>