DelphiFAQ Home Search:

Converting Mac style text files to Unix style


comments192 comments. Current rating: 3 stars (185 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 12 of 13, other pages: 1 2 3 9 10 11 [12] 13
2014-05-08, 19:26:04
payday loans  
szribio payday loans 6022 unsecured loans online up to 1000 FrOjm 100 day loans nFxBLW instant loans >:-OOO
2014-05-11, 07:54:38
loans with bad credit  
vhltqfd loans with bad credit 0029 payday loans jLBlc money mutual 2968 installment loans >:-OOO
2014-05-13, 10:52:16
money mutual  
iswwobc money mutual RdOtha payday loans 3006 installment loans :-O loans with bad credit OnMMwS
2014-05-21, 22:02:48
payday advance  
acctqa payday advance >:]] payday loans gvLXj pay day loans TLDAf cash advance online :-O
2014-05-24, 18:03:13
no credit check loans  
loxgly no credit check loans %-[[[ online payday advance 8258 90 day loans JCQfog payday installment loans online SZEqZB
2014-05-25, 01:52:42
payday loans  
zpzyds payday loans %-[[[ payday loans :-O payday loans >:]] payday loans >:-[ payday loans >:-[
2014-05-26, 02:27:11
90 day loans  
mzwhoh 90 day loans 9247 online payday advance mFHKA payday installment loans online >:-OOO no credit check loans 9804
2014-05-31, 06:04:19
money mutual funds  
rslukkvj money mutual funds =-] apply for small loans :-O payday installment loans YGenD payday loans 7966
2014-05-31, 07:26:50
payday loans  
spohsrmh payday loans pqaBAF payday loans >:-OOO payday loans =-] payday loans >:]] payday loans 4263 payday loans 6402 payday loans WDdrB payday loans >:-OOO
2014-06-05, 18:43:54
payday loans  
fxirzm payday loans AxlFvJ payday loans 5515 payday loans VDwnaz payday loans 8]]] payday loans XQUXlk payday loans >:-[ payday loans 2940 payday loans xIuvFG
2014-06-05, 21:05:34
payday loans  
gocmuh payday loans cHINd online loans with no credit check 8]]] loans without credit check aZrCJ apply for fast cash 2988
2014-06-06, 19:41:31
payday loans  
ejwknoh payday loans 7273 apply for fast cash eWRqb online loans with no credit check %-[[[ loans without credit check 8508
2014-06-26, 20:34:22
payday loans  
zucmklze payday loans %-[[[ payday loans tanSd payday loans OVvyj payday loans :-O
2014-06-30, 19:19:04
payday loans  
kecuvt payday loans ExzIoF payday loans >:-[ payday loans DPmLu payday loans 7505
2014-07-01, 12:31:09
instant loan today  
natdhdi instant loan today %-[[[ magnum cash advance >:]] instant cash loans 0428 online loans same day %-[[[
You are on page 12 of 13, other pages: 1 2 3 9 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: