[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: LF to CR Conversion
- Subject: Re: LF to CR Conversion
- From: mnementh@netcom.com (David R. Villegas)
- Date: Mon, 19 Sep 1994 20:48:49 GMT
- Newsgroups: comp.sys.apple2
- Organization: Ministry of Love - Room 101
- References: <35h9pe$jc8@panix2.panix.com>
moxie@panix.com (Mark Mentovai) wrote:
>OK.....I think Nulib should be able to do this, but I can't figure out
>how. I want to know of a program for Unix that will change all Linefeeds
>to Carriage Returns in a specified file, so I can compress it before
>downloading it and having to worry about deleting pound-signs in
>AppleWorks, which is a pain in the neck on large files, and the small
>ones are starting to bug me now too. <-- Long Sentence!
I just use the following script (which I call jtom):
#!/usr/bin/sh
pid=$$
trap "rm /tmp/jtom.$pid 2> /dev/null ; mv /tmp/jtom.$pid.2 $1 2> /dev/null; \
exit" 15 2 1
while test $# -gt 0
do
/usr/bin/echo -n $1
/usr/bin/echo -n ' ... '
cp $1 /tmp/jtom.$pid.2
cat $1 | tr \\012 \\015 > /tmp/jtom.$pid
mv /tmp/jtom.$pid $1
rm /tmp/jtom.$pid.2
shift
/usr/bin/echo 'done'
done
To convert ^M's to ^J's, just switch the \\012 and \\015.