Also to address the root cause, the OP said it was on the end of every line.
I would check the whole system - depending on the journeys and gyrations the
CSV file goes through before you get it.  An intelligent use of ASCII ftp
(binary bad) and/or chomp will usually take care of any of the
cross-platform weirdness on the end of your lines.

-Tom Kinzer

-----Original Message-----
From: agftech lists [mailto:[EMAIL PROTECTED]
Sent: Friday, December 19, 2003 9:00 AM
To: [EMAIL PROTECTED]
Subject: Re: how to remove a ^M charaters from a variable


I'd found this here
http://www.unixblog.com/quick_unix_tips/remove_m_with_vi.php
------------
You can try this on multiple files
perl -pi -e 's/\015//g' files
------------




On Sat, 2003-12-20 at 07:21, David Inglis wrote:
> I am reading in a csv file and it has a control character ^M at the end
> of each line how can I remove these charaters, I have tried the following
> and had no success.
>
> $a=~s/\^M//;
> $a=~s/^M//;
>
>
> Any help appreciated thanks.
>
>
> --
> Regards
>
>
>
> David Inglis
> 0408502342


______________________
Aman Raheja
AGF Technologies
http://www.agftech.com
______________________


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to