[techtalk] vi technique for dos2unix

Christian MacAuley jellhead at jellspace.net
Wed May 3 12:19:08 EST 2000


I wrote this script to get rid of the ghastly carriage returns in my DOS
files on my FreeBSD system.  I use it like this:

> nocr dosfile.txt

=======================
#!/usr/local/bin/tsh

if test $# -eq 0
  then echo "You didn't enter a filename."
elif test -f "$1"
  then cat $1 | tr -d "\015" > $1
  echo "The carriage returns are all gone."
else
  echo "That file doesn't exist."
fi
======================

~Christian






More information about the Techtalk mailing list