*BSD News Article 97579


Return to BSD News archive

Path: euryale.cc.adfa.oz.au!newshost.carno.net.au!harbinger.cc.monash.edu.au!munnari.OZ.AU!news.ecn.uoknor.edu!feed1.news.erols.com!cpk-news-hub1.bbnplanet.com!news.bbnplanet.com!newsserver.jvnc.net!newsreader.jvnc.net!not-for-mail
From: Samath Wijesundera <samath@slt.lk>
Newsgroups: comp.unix.bsd.freebsd.misc
Subject: Re: dos2unix
Date: Thu, 12 Jun 1997 11:58:56 +0600
Organization: A poorly-installed InterNetNews site
Lines: 36
Message-ID: <339F9020.5C80@slt.lk>
References: <339E506B.D46@slt.lk> <5nmbf4$f5i@flatland.dimensional.com>
Reply-To: samath@slt.lk
NNTP-Posting-Host: kandy.slt.lk
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Mailer: Mozilla 3.01Gold (Win95; I)
CC: samath@slt.lk
Xref: euryale.cc.adfa.oz.au comp.unix.bsd.freebsd.misc:42779

Thanks Michael,

I have been trying to do this with sed. But sed does not recognize 
	\r	\n	etc.

eg: sed 's/\r//g' filename.dos > filename.unix
does not work ? Do you know why ?

I later found the keystrokes to do this ^V^M. If you know why \r etc. is
not recognized in sed let me know ?


Regards,
Samath Wijsundera

Michael Fuhr wrote:
> 
> Samath Wijesundera <samath@slt.lk> writes:
> 
> > Does anyone know if there is script or a utility to convert dos text
> > files to unix format for BSD?
> 
> This strips carriage returns from the end of a line (dos2unix):
> 
>     perl -pe 's/\r+$//' /path/to/your/file

> 
> This will add one (unix2dos):
> 
>     perl -pe 's/$/\r/' /path/to/your/file
> 
> Hope this helps.
> 
> --
> Michael Fuhr
> http://www.dimensional.com/~mfuhr/