Converting DOS text files

John R. Levine johnl at esegue.segue.boston.ma.us
Tue Oct 16 23:40:08 AEST 1990


In article <1477 at pai.UUCP> erc at pai.UUCP (Eric Johnson) writes:
>The problem is this: when you use a DOS-based copy command to copy a text
>file onto your system (from a PC floppy, say), that DOS text file
>is full of CR/LFs (instead of the UNIX line feed) and has a trailing
>Ctrl-Z.  [172 line program follows]

Here's a six-line shell script that does the same thing.  I call it uncr.

#!/bin/sh
# Get rid of carriage returns in files
# Dedicated to the public domain, do anything with it you want. -jrl

for i
do
	echo $i:
	qfile=`dirname $i`/QQ`basename $i`
	mv $i $qfile && tr -d \\015\\032 <$qfile >$i && rm $qfile
done

-- 
John R. Levine, IECC, POB 349, Cambridge MA 02238, +1 617 864 9650
johnl at esegue.segue.boston.ma.us, {ima|spdcc|world}!esegue!johnl
Atlantic City gamblers lose $8200 per minute. -NY Times



More information about the Comp.unix.sysv386 mailing list