in reply to Removing Control Characters

perl -p -e "s/\r$//" (FileName)
this will print the file to std out DO NOT be tempted to redirected back to the original file as you will truncate it. Something like
perl -p -e "s/\r$//" (FileName) > op;mv op (FileName)
Will strip the ^M's and put the file back where it started.
HTH
--

Zigster

Replies are listed 'Best First'.
Re: Re: Removing Control Characters
by McD (Chaplain) on Feb 23, 2001 at 00:09 UTC
    zigster writes:

    DO NOT be tempted to redirected back to the original file as you will truncate it.

    Better yet, use Perl's in place file editing feature:

    perl -p -i -e 's/\r$//' (filename)

    Plus, if you use

    -i.foo
    a backup copy of filename before the changes will be stored in "filename.foo"

    Peace,
    -McD