[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [seul-edu] Carriage returns



Bill Tihen -- TECHNOLOGY wrote:
> 
> Is there some little utility to strip carriage returns
> out of dos file and replace them with \n or do I need to
> write  my own little script?

Bill, a colleague of mine sent me this perl script months ago, and it is
quite useful. Hope it helps,

Pete

-- 
Pete St. Onge
pete@seul.org
#!/bin/sh
echo Stripping Carriage Returns from files...
for i
do
        # If a writable file
        if [ -f $i ]
        then
                if [ -w $i ]
                then
                        echo $i
                        # strip CRs from input and output to temp file
                        tr -d '\015' < $i > toix.tmp
                        mv toix.tmp $i
                else
                        echo $i: write-protected
                fi
        else
                echo $i: not a file
        fi
done