Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.milw.wisc.edu!nic.MR.NET!srcsip!orion!rogers From: rogers@orion.SRC.Honeywell.COM (Brynn Rogers) Newsgroups: comp.sys.ibm.pc Subject: Re: Text file conversion between UNIX and MSDOS Message-ID: <16764@srcsip.UUCP> Date: 13 Feb 89 21:41:52 GMT References: <89Feb9.123853est.2662@godzilla.eecg.toronto.edu> <6483@hoptoad.uucp> Sender: news@src.honeywell.COM Reply-To: rogers@orion.UUCP (Brynn Rogers) Distribution: na Organization: Honeywell Systems & Research Center, Camden, MN Lines: 54 In article <89Feb9.123853est.2662@godzilla.eecg.toronto.edu> noworol@eecg.toronto.edu (Mark Noworolski) writes: >Very frequently when I get stuff off the net I run into the problem of >no carriage returns. It appears that UNIX stores text a little differently >from Messdos. > >Bafore writing something to fix this problem... I figure somebody's probably >already done it. > >Can somebody send me a program to do this? >mark > I wrote a couple of shell scripts that use sed to make the conversion back and forth. Also I have a couple to convert filenames from lower case to UPPER and back again. Here they are: (note: they all are executible and work on whatever arguments they are given. wildcards are okay.) ==> mkdos <== ;;; this one goes from unix to dos files ;;; the sed command is 's/$/^M/g' and you get the ^M by ;;; typeing backslash return #! /bin/csh -f foreach filename ($*) echo processing $filename cat $filename | sed 's/$/ mv ~/.mkdos.tmp $filename end echo "Done" ==> mkunix <== #! /bin/csh -f foreach filename ($*) echo processing $filename cat $filename | sed "s/ mv ~/.mkunix.tmp $filename end echo "done " ==> mklc <== ;; make lower case #! /bin/csh -f foreach name ($*) mv $name `echo $name | tr '[A-Z]' '[a-z]'` end ==> mkuc <== ;; make upper case #! /bin/csh -f foreach name ($*) mv $name `echo $name | tr '[a-z]' '[A-Z]'` end 'Seek out new life and civilizations' | Brynn Rogers Honeywell S&RC "Honey, come see what I | UUCP: rogers@orion.uucp found in the refrigerator!" | !: {umn-cs,ems,bthpyb}!srcsip!rogers | Internet: rogers@src.honeywell.com