Rules | Recent posts | topic RSS | Search | Register  | Log in

Is there a unix equivalent dos2unix utility in linux?

 
Post new topic  Reply to topic    EDAboard.com Forum Index -> Linux Software
Author Message
shemo



Joined: 26 Apr 2002
Posts: 28


Post05 Jun 2002 23:51   Is there a unix equivalent dos2unix utility in linux?

I couldn't find it. pls advise.
thanks
Back to top
cdic



Joined: 28 Jun 2001
Posts: 151
Helped: 2
Location: silly valley


Post06 Jun 2002 1:26   

just remove all "^M" from your files using vi or sed or other editors. no need using dos2unix, you can write a simple script to implement this. and name dos2linux. Smile
Back to top
CatKing



Joined: 05 Jun 2001
Posts: 277
Helped: 1


Post06 Jun 2002 3:21   

Hi, There:
http://ibiblio.org/pub/Linux/utils/text/dos2unix-3.0.tar.gz
Back to top
jimjim2k



Joined: 17 May 2001
Posts: 1243
Helped: 10


Post06 Jun 2002 8:27   

Hi

Try this perl script

#!/usr/bin/perl
# convert a dos \r\n format to unix \bn
open (FILE, $ARGV[0]);
while (<FILE>) {
# remove the stupid \r, replace with \n
# some broken editors just put \r
s/\r/\n/g;
# Remove the duplicate \n
s/\n\n/\n/g;
print;
}



tnx
Back to top
jimjim2k



Joined: 17 May 2001
Posts: 1243
Helped: 10


Post06 Jun 2002 8:35   

Hi

BTW:

Look at the following perl link for additional free perl scripts.
It is searchable too.


1. h**p://www.perlmonks.org


* -> t

tnx
Back to top
tdo48



Joined: 13 Jan 2002
Posts: 21


Post06 Jun 2002 17:27   

Or you meant the reverse operation: unix2dos.....
Back to top
Post new topic  Reply to topic    EDAboard.com Forum Index -> Linux Software
Page 1 of 1 All times are GMT + 2 Hours


Abuse
Administrator
Moderators
topic RSS 
sitemap