[ale] Mac/Unix linefeed wierdness

Fletch fletch at phydeaux.org
Fri Jan 19 13:37:49 EST 2001



        Macs use ^M (\015) as the newline (\n) character (as opposed
to ^J (\012) for UNIXen and ^M^J (\015\012) for DOS and friends).
Assuming the existence of perl in your path:


## mac to unix
perl -i -pe 's/\015/\012/g' macfile
## unix to mac
perl -i -pe 's/\012/\015/g' unixfile
## unix to dos
perl -i -pe 's/\012/\015\012/g' unixfile


        `mac to dos' and `dos to mac' are left as exercieses for the
reader.  If you want to keep backup copies of the files, change the
`-i' to `-i.bak' instead.

-- 
Fletch                | "If you find my answers frightening,       __`'/|
fletch at phydeaux.org   |  Vincent, you should cease askin'          \ o.O'
770 933-0600 x211(w)  |  scary questions." -- Jules                =(___)=
                      |                                               U
--
To unsubscribe: mail majordomo at ale.org with "unsubscribe ale" in message body.





More information about the Ale mailing list