DelphiFAQ Home Search:

Converting Mac style text files to Unix style


comments195 comments. Current rating: 3 stars (186 votes). Leave comments and/ or rate it.


I moved a folder of HTML files from a Mac to a Unix box and now the files look messy. I see lots of ^M characters in vi. How can I clean it up?


Applications on the Mac platform usually use carriage returns (#13 or ^M) as line separators.
Windows applications use carriage return + line feed (#13#10 or ^M^J).
Unix applications use only line feed (#10, ^J)

The best thing to do is to configure your ftp tool (e.g. Dreamweaver) to send files 'ASCII' style.

You can also use the following unix command to edit your file. The '\r' is the carriage return, replaced by a newline '\n'

The second command does the same, using perl instead.

If your Linux installation has the tool mac2unix (e.g. in /usr/bin) then you may use this tool. It can take wildcards!

tr '\r' '\n' <index.html >index2.html

perl -p -e 's/\r/\n/g'  <index.html >index2.html

// convert all html files using /usr/bin/mac2unix
mac2unix *.html

// recursively convert all html files in subdirectories
find . | mac2unix

Content-type: text/html


You are on page 13 of 13, other pages: 1 2 3 10 11 12 [13]
2014-07-03, 12:09:33
online loans same day  
wdwhzytb online loans same day HMTcAo instant loan today xOLkpK instant cash loans 3843 magnum cash advance CPAaiy
2014-07-04, 07:01:22
magnum cash advance  
xjwcubji magnum cash advance KkQpc instant cash loans =-] instant loan today >:]] online loans same day ctsJZN
2014-07-04, 12:22:40
payday loans  
frdtmjt payday loans IUYMxT payday loans :-O payday loans 4381 payday loans 8]]]
2014-08-03, 23:53:01
money mutual  
njquzs money mutual 5688 emergency loans for bad credit 8]]] money mutual installment loans APrbOQ plain green loans ixyXn get a loan today 7485
2014-08-06, 00:26:31
easy payday loans  
jafblw easy payday loans 5064 payday loans 4577 money mutual 6420 mobile loans 8]]] cash loans online >:-[
2014-08-06, 08:05:30
cash loans online  
oofwkd cash loans online sMbsux money mutual 2198 easy payday loans 7557 payday loans 6058 mobile loans 3796
2014-08-08, 20:26:23
sameday loan  
mhvjvn sameday loan =-] spot loan wEpTO sameday payday loans online :-O payday loans :-O money mutual 1155
2014-08-16, 23:36:50
next day loans  
izsasy next day loans 4476 money mutual AwPDY payday loans 6410 payday loans >:-[ payday loans 9544
2014-08-18, 13:20:50
payday loans  
ozdmxw payday loans 0737 money mutual :-O payday loans 6802 payday loans mvbrc next day loans 9542
2014-11-14, 08:28:24
payday loans  
giblvfn payday loans 6056 payday loans 5370 payday loans >:-[ payday loans 8785 payday loans 8867 payday loans 6551
2014-11-14, 15:53:10
mobile loans  
ounbyawe mobile loans 8]]] fast payday loans feFpk payday loans no credit check 6859
2015-02-01, 04:04:43
anonymous from Ecuador  
This piece was cogent, wetlrw-itlen, and pithy.
2015-02-12, 20:12:05
anonymous from Venezuela  
pertain medical-related sites installing how much erectile dysfunction many manufacturers
2015-02-12, 20:12:10
anonymous from China  
pertain medical-related sites installing how much erectile dysfunction many manufacturers
2015-02-13, 06:57:25
payday loans  
eznrctnn payday loans >:]] payday loans 1043 payday loans QStBXl payday loans %-[[[ payday loans 4844 payday loans 8]]]
You are on page 13 of 13, other pages: 1 2 3 10 11 12 [13]



NEW: Optional: Register   Login
Email address (not necessary):

Rate as
Hide my email when showing my comment.
Please notify me once a day about new comments on this topic.
Please provide a valid email address if you select this option, or post under a registered account.

Show city and country
Show country only
Hide my location
You can mark text as 'quoted' by putting [quote] .. [/quote] around it.
Please type in the code:

Please do not post inappropriate pictures. Inappropriate pictures include pictures of minors and nudity.
The owner of this web site reserves the right to delete such material.

photo Add a picture: