Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Convert end-of-line characters (revisited)' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Convert end-of-line characters (revisited)
Authored by: rjbailey on Oct 21, '03 02:12:23PM
To display mac text files at the command line in Terminal.app (or to pipe this to a new file), I created a script called "mac2unix" that contains one line:
cat $1 | tr '\r' '\n'

To convert unix files to Mac files, here is "unix2mac":
cat $1 | tr '\n' '\r'

To convert DOS files to unix files, here is "dos2unix":
cat $1 | tr -d '\r'

These employ the "tr" (translate character) utility.

[ Reply to This | # ]
Convert end-of-line characters (revisited)
Authored by: LC on Oct 21, '03 05:27:40PM

Need double-backslashes in this website (one gets
eaten by the remove slashes step, after previewing;)
I got bitten by that too; Larry.



[ Reply to This | # ]