*BSD News Article 97554


Return to BSD News archive

Path: euryale.cc.adfa.oz.au!newshost.carno.net.au!harbinger.cc.monash.edu.au!news.mel.connect.com.au!munnari.OZ.AU!news.ecn.uoknor.edu!news.wildstar.net!news.ececs.uc.edu!newsfeeds.sol.net!feed1.news.erols.com!newsfeed.internetmci.com!dimensional.com!flatland.dimensional.com!not-for-mail
From: mfuhr@dimensional.com (Michael Fuhr)
Newsgroups: comp.unix.bsd.freebsd.misc
Subject: Re: dos2unix
Date: 11 Jun 1997 08:07:32 -0600
Organization: Dimensional Communications
Lines: 18
Message-ID: <5nmbf4$f5i@flatland.dimensional.com>
References: <339E506B.D46@slt.lk>
NNTP-Posting-Host: flatland.dimensional.com
X-Newsreader: NN version 6.5.1 (NOV)
Xref: euryale.cc.adfa.oz.au comp.unix.bsd.freebsd.misc:42751

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/