Converting DOS text files

Dick Dunn rcd at ico.isc.com
Wed Oct 17 05:10:59 AEST 1990


erc at pai.UUCP (Eric Johnson) writes about converting DOS text files (with
CR-LF line terminators and final ^Z) for UNIX.

> ...On SCO, there is a program to take care of this, called
> dtox...

Much to my surprise, he's right that SCO really did make it a program. 
Back in the days of UNIX, we would have used one of the little filter
programs (like tr or sed) that came with the system.  Oh well, "forward
into the past" and "programmer's full employment" and all that.

>...Unfortunately, dtox is a filter. That is, you call it
> with something like:
> 
>      dtox dosfile > unixfile

Why is that a problem?  A filter is just slightly more general: You can
apply a filter to files; a program written to handle only files can't be
used in a pipe sequence.  But let's forge ahead...

> This is nice, but I have a big problem. I have 30 to 40 files I
> want to un-DOS at a time. I want to be able to type something
> like 
>     undos *.txt

A big problem?  Why not (in sh notation):
	for f in *.txt
	do cp $f /tmp/d$$
	   dtox /tmp/d$$ >$f
	done
	rm /tmp/d$$

or go all the way to a UNIX approach and replace the dtox line with
	tr -d '\015\032' </tmp/d$$ >$f
-- 
Dick Dunn     rcd at ico.isc.com -or- ico!rcd       Boulder, CO   (303)449-2870
   ...Never offend with style when you can offend with substance.



More information about the Comp.unix.sysv386 mailing list