[comp.sys.apple] CR/CR-LF Problems.

rob@cires.colorado.edu (Rob Cuthbertson) (02/17/89)

Unix people, stick this in your .cshrc:
---Cut Here---
alias nl2cr     "cat \!^ | tr '\012' '\015' > \!^.X ; rm -f \!^ ; mv \!^.X \!^"
alias cr2nl     "cat \!^ | tr '\015' '\012' > \!^.X ; rm -f \!^ ; mv \!^.X \!^"

#Before you download a Unix file to your Apple, type "nl2cr <file>" and after
#you upload an Apple file to the Unix system type "cr2nl <file>".  Takes care
#of the incompatibilities between the Apple and Unix line delimiters.
#-- 
#Lazlo Nibble (cscbrkac@charon.unm.edu)
---Cut Here---

This was posted to this newsgroup some time ago, and I had waited to re-post
it, since I thought surely someone else would have by now.  (or even Lazlo
might have)  

But, since it didn't show up on it's own...

btw.. I'm sure there is a similarly simple way to do the same thing under 
VAX/VMS, I just don't know the OS well enough to say what it is.

--Rob Cuthbertson
+-----                                                                  -----+
| cires!rob@boulder.colorado.edu <--OR--> ..!{ncar.nbires}!boulder!cires!rob |
| "I'm going to let you in on a   \/\/\/ little secret, Ray.  K-mart sucks." |
+-----                             \/\/                                 -----+

cs1552ao@charon.unm.edu (Lazlo Nibble) (02/27/89)

>Unix people, stick this in your .cshrc:
>---Cut Here---
>alias nl2cr     "cat \!^ | tr '\012' '\015' > \!^.X ; rm -f \!^ ; mv \!^.X \!^"
>alias cr2nl     "cat \!^ | tr '\015' '\012' > \!^.X ; rm -f \!^ ; mv \!^.X \!^"
>
>#Before you download a Unix file to your Apple, type "nl2cr <file>" and after
>#you upload an Apple file to the Unix system type "cr2nl <file>".  Takes care
>#of the incompatibilities between the Apple and Unix line delimiters.
>#-- 
>#Lazlo Nibble
>---Cut Here---
>
>This was posted to this newsgroup some time ago, and I had waited to re-post
>it, since I thought surely someone else would have by now.  (or even Lazlo
>might have)  
>
>But, since it didn't show up on it's own...
>
>--Rob Cuthbertson

Yow!  Have I been ARCHIVED yet?

Two small shellscripts can also do the job for you in a slightly more
friendly and informative manner:

#! /bin/sh
# nl2cr -- convert UNIX newlines to Apple II CRs
for i in $*
do
echo -n $i': '
tr '\012' '\015' < $i > $i.X
mv -f $i.X $i
echo 'done'
done

#! /bin/sh
# cr2nl -- convert Apple II CRs to UNIX newlines
for i in $*
do
echo -n $i': '
tr '\015' '\012' < $i > $i.X
mv -f $i.X $i
echo 'done'
done

I realize that BinSCII makes all this hoo-hah obsolete, but what the heck.  I
still use 'em to download textfiles and such.

                                                                         Lazlo
------------------------------------------------------------------------------
cs1552ao@charon.unm.edu     "Shshshsh-Shop as usual...and avoid panic buying."