[comp.sys.apple2] ^J <-> ^M

marekp@contact.UUCP (Marek Pawlowski) (07/25/90)

 
To change all the ^J's in a file to ^M's, on a Unix system.  Execute
the following command:
 
tr '\012' '\015' <old.file >new.file
^     ^      ^       ^         ^
|     |      |       |         |___________ The new file to be created
|     |      |       |_____________________ The original file to be translated
|     |      |_____________________________ OCT for ^M
|     |____________________________________ OCT for ^J
|__________________________________________ Translate command
 
Hope that helps!
 
root@aunix.uucp		| Marek Pawlowski
marekp@contact.uucp	| Richmond Hill,
marekp@generic.uucp	| Ontario,
			| CANADA
"Send lawsuits, complaints, grudges, flames, sacrificial animals, and
 court orders to the addresses listed below:"

reeder@reed.bitnet (Doug Reeder,,,2343817) (07/30/90)

In article <m0huTSD-0002u2C@contact.uucp> marekp@contact.UUCP (Marek Pawlowski) writes:
_
_ 
_To change all the ^J's in a file to ^M's, on a Unix system.  Execute
_the following command:
_ 


Or better yet, put the following in your .login or .cshrc:

alias lf2cr "cat \!^ | tr '\012' '\015' > \!^.X ; rm -f \!^; mv \!^.X \!^"
alias cr2lf "cat \!^ | tr '\015' '\012' > \!^.X ; rm -f \!^; mv \!^.X \!^"

use as follows:
lf2cr foo.file
cr2lf bar.file

Or, if you're really ambitious, you could revise these so that lf2cr and
cr2lf work for more than one file at a time.

Doug Reeder                                   USENET: ...!tektronix!reed!reeder
from ARPA: tektronix!reed!reeder@berkeley.EDU BITNET: reeder@reed.BITNET
7th: Each swallow works hard to be perfect pilot-provider-builder-trainer-
teacher-lover-mate,no half-true hate!   - Dr.Brommer's 18-in-1 Pure Castile Soap