James Ng wrote:
>
> hello:
>
> can somebody teach me how do i write a perl script to delete the
> character ^M in a file.
> for example, i have a file called index.html and i want to delete all the
> ^M characters in the file. Thank you.
>
<snip>
dos2unix filename # without backup
perl -pi.bak -e 's/\015//g;'
# with backup in filename.bak
perl -pi.bak -e 's/\015$//;'
# same, but limits the removal to ^M's at the end of lines.
Marc
--
Marc Mutz <[EMAIL PROTECTED]> http://marc.mutz.com/Encryption-HOWTO/
University of Bielefeld, Dep. of Mathematics / Dep. of Physics
PGP-keyID's: 0xd46ce9ab (RSA), 0x7ae55b9e (DSS/DH)
-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to [EMAIL PROTECTED]
Please read the FAQ at http://www.linux-learn.org/faqs