unixdosmaclinebreak
 


--------------------------------------------------------------------------------
CONVERTING CARRIAGE RETURNS
--------------------------------------------------------------------------------
perl -p -i -e 's/\n/\n\r/g' *.n
--------------------------------------------------------------------------------


--------------------------------------------------------------------------------
CARRIAGE RETURNS AND LINE FEEDS
--------------------------------------------------------------------------------
When not saved using the UNIX newline line ends, such files need to be converted
into the native UNIX format or else some command utilities will not process
them correctly. Mac OS ends lines with the carriage return character, and many
text processing tools treat such files as a single line. To fix that, we can use
the following tricks:

* Mac -> UNIX:
[unixconsole$] tr '\r' '\n' < macfile > unixfile

* UNIX -> Mac:
[unixconsole$] tr '\n' '\r' < unixfile > macfile

Microsoft DOS/Windows convention is to end each line of text with the carriage
return character followed by the newline character. To fix that, use the
following commands:

* DOS -> UNIX:
[unixconsole$] tr -d '\r' < dosfile > unixfile

* UNIX -> DOS:
in this case we need to use awk, because tr cannot insert two characters in
place of one. The command to use is
[unixconsole$] awk '{ print $0"\r" }' < unixfile > dosfile

--------------------------------------------------------------------------------