From owner-freebsd-questions Sat May 4 22:54:47 2002 Delivered-To: freebsd-questions@freebsd.org Received: from starbug.ugh.net.au (starbug.ugh.net.au [203.31.238.37]) by hub.freebsd.org (Postfix) with ESMTP id 50F7E37B41C for ; Sat, 4 May 2002 22:54:44 -0700 (PDT) Received: by starbug.ugh.net.au (Postfix, from userid 1000) id 51990A804; Sun, 5 May 2002 15:54:42 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by starbug.ugh.net.au (Postfix) with ESMTP id 502CD542D; Sun, 5 May 2002 15:54:42 +1000 (EST) Date: Sun, 5 May 2002 15:54:42 +1000 (EST) From: Andrew To: shubhamr Cc: "questions@FreeBSD.ORG" Subject: Re: such a pain In-Reply-To: <3CD4B6D2.9858CAE0@malkauns.nsc.com> Message-ID: <20020505155129.I53078-100000@starbug.ugh.net.au> X-WonK: *wibble* MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG 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