[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: AWK: adds "^M" at the end of line?



On Tue, Jun 25, 2002 at 12:08:34PM +1000, Matthew Dalton wrote:
> > On Mon, Jun 24, 2002 at 05:10:15AM -0400, Abdul Latip wrote:
> > > > What file are you trying to read.  If it is mail coming from fetchmail,
> > > > there were some change which causes ^M in mail file.
> > >
> > > It is ftp://ftp.isi.edu/in-notes/rfc-index.txt
> > > I believe that that file does not have ^Ms.
> > > Basically, what I am doing (once in a while), to get
> > > a recent rfc-index file, and merging each rfc description
> > > (1-3 lines) into one line. The script is actually simple
> > > and stupid.
> 
> The original file is a dos format text file. Dos text files have CR-LF
> at the end of every line, whereas unix files only have LF. The extra CR
> is the ^M you're seeing. Obviously awk (mawk?) is not handling the text
> format properly, instead assuming it is a unix format file. Your belief
> that the original file does not have ^Ms is incorrect. It does have
> them, but they just don't show up on most editors. If you edit it with
> nvi, you'll see them there.
> 
> I'd suggest one of two things:
> 1. If your awk is mawk, try installing gawk (GNU awk) and see if that
> handles dos text files better.
> 2. Convert the files by removing the ^Ms before running awk on them.
> 
> This is basically a compatibility problem, not a bug in awk.
> 
> Matthew
> 
I asked a different question for which the answer is appropriate here.

The sysutils package contains, among other things, two programs, fromdos
and todos. Fromdos removes ^M from files and todos inserts ^M before each
line feed, effectively converting a UNIX test file into a DOS text file.
fromdos will remove your carriage returns (^M).


-- 
Paul E Condon           
pecondon@quiknet.com    


-- 
To UNSUBSCRIBE, email to debian-user-request@lists.debian.org 
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org



Reply to: