Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 5 May 2002 15:54:42 +1000 (EST)
From:      Andrew <andrew@ugh.net.au>
To:        shubhamr <shubhamr@malkauns.nsc.com>
Cc:        "questions@FreeBSD.ORG" <questions@freebsd.org>
Subject:   Re: such a pain
Message-ID:  <20020505155129.I53078-100000@starbug.ugh.net.au>
In-Reply-To: <3CD4B6D2.9858CAE0@malkauns.nsc.com>

next in thread | previous in thread | raw e-mail | index | archive | help


On Sun, 5 May 2002, shubhamr wrote:

> I have some .c files which I got from my windows machine.But when I read
> it on BSD,for every line end ^M shows up,whereever there is a
> newline(carriage return).It is tedious to remove them manually.I have no
> X installed on my BSD.Can anyone suggest how to get rid of them?

This is because windows/DOS ends lines in ASCII files with CR LF whereas
UNIX only uses LF. Consequently you see the CR (^M) before each new line.

There are many ways to remove or avoid them -

a) if you are using FTP transfer the files in ASCII mode

b) there are various versions of dos2unix et al floating around

c) tr -d "\r" < file.c > newfile.c

...and many more...

Andrew


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020505155129.I53078-100000>