converting PC text files to UNIX WordPerfect

Bill Campbell campbell at Thalatta.COM
Sat May 26 05:04:33 AEST 1990


In article <21463 at boulder.Colorado.EDU> baileyc at tramp.Colorado.EDU (BAILEY CHRISTOPHER R) writes:
>Help, I need to transfer some text/ASCII files generated by a program on
>an IBM AT to our UNIX system, and then edit the files from the UNIX system
>with Word Perfect 4.2 for UNIX.  Everything was fine until we started 
>[deleted]
>So, I need to know what to do in Word Perfect, or I need a wild card expander
>for DOS and UNIX (I process about 40 files each time we do this, so I cna't
>sit there and type DOS2UNIX dosfile > unixfile, etc.
>Thanks!
>.
The only difference I have ever seen between text files on dos
and unix is the the dos files lines all end in \r\n (carriage
return, line feed) and unix files don't have the carriage return.

A very simple program to do this would be: (written as I reply)

:
# remove carriage returns from dos files creating unix equivalents
# USAGE dostounix dosfile unixfile
# (dosfile and unixfile may be empty in which case this is a simple filter

sed 's/^M$//' $1 > $2

exit $?
#end of program

The ^M is an actual carriage return (CTRL-M) since not all
versions of sed will recognize the \r sequence.  To enter this
with the vi editor press <CTRL-V><CTRL-M>, the CTRL-V tells vi to
take the next character literally.
-- 
....microsoft--\                    Bill Campbell; Celestial Software
...uw-entropy----!thebes!camco!bill 6641 East Mercer Way
....fluke------/                    Mercer Island, Wa 98040
....hplsla----/                     (206) 232-4164



More information about the Comp.unix.questions mailing list