On Fri, Mar 10, 2000 at 02:17:39PM -0600, 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.
> 
perl is kinda overkill for this. It can be done with tr or sed

tr -d '\015' < file
or
sed -n -e l file | sed 's/\\r\|\$$//g'

but it you truly desire perl, this will do it:

perl -e 'while (<>){print split/\x0d/;}'

have fun 

greg
-- 
dronf!

-
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

Reply via email to