Re: how to remove a ^M charaters from a variable

2003-12-18 Thread Randy W. Sims
On 12/20/2003 8:21 AM, 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. ^M is the carriage return. Try s/

RE: how to remove a ^M charaters from a variable

2003-12-19 Thread Tom Kinzer
tr/015//; -Tom Kinzer -Original Message- From: Randy W. Sims [mailto:[EMAIL PROTECTED] Sent: Thursday, December 18, 2003 8:05 PM To: David Inglis Cc: [EMAIL PROTECTED] Subject: Re: how to remove a ^M charaters from a variable On 12/20/2003 8:21 AM, David Inglis wrote: > I am read

RE: how to remove a ^M charaters from a variable

2003-12-19 Thread Jaffer
Hai David, I don't where you tried this have you tried this in NT or in UNIX? $a="jaffer^"; $a=~s/\^M//; This works in NT print $a; But it wont works in Unix. Try this way in Unix $a=~s/\015//g; Let me know if any Thank you jaffer -Original Message- From: David Inglis [mailto:

Re: how to remove a ^M charaters from a variable

2003-12-19 Thread Rob Dixon
Tom Kinzer wrote: > > tr/015//; This will do nothing to the string. It will just return the number of zero, one and five characters it finds. Control-M is "\cM" or "\x0D" or "\015" or "\r" To get 'tr' to delete the characters it finds you need the /d modifier. tr/\015//d will do the

RE: how to remove a ^M charaters from a variable

2003-12-19 Thread Tom Kinzer
right - my bad. what i mean, not what i say! thanks rob. -Tom Kinzer -Original Message- From: Rob Dixon [mailto:[EMAIL PROTECTED] Sent: Friday, December 19, 2003 3:07 AM To: [EMAIL PROTECTED] Subject: Re: how to remove a ^M charaters from a variable Tom Kinzer wrote: > >

RE: how to remove a ^M charaters from a variable

2003-12-19 Thread Dan Muey
> Hai David, > > I don't where you tried this > have you tried this in NT or in UNIX? > > $a="jaffer^"; > $a=~s/\^M//; This works in NT > print $a; > > But it wont works in Unix. Sure it does: (unless you're talking goofy data of a binary hexy sort of thing, which you might be since I comple

Re: how to remove a ^M charaters from a variable

2003-12-19 Thread Dan Anderson
> "\r" Caveat: Only on *nix systems. Otherwise \n is 0x1512 and not 0x12. -Dan -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: how to remove a ^M charaters from a variable

2003-12-19 Thread Dan Anderson
On Fri, 2003-12-19 at 11:54, Dan Anderson wrote: > > "\r" > > Caveat: Only on *nix systems. Otherwise \n is 0x1512 and not 0x12. That should read Otherwise \n can be 0x1512 -- i.e. on Windoze boxen. On Macs it's something different. -Dan -- To unsubscribe, e-mail: [EMAIL PROTECTED] For ad

Re: how to remove a ^M charaters from a variable

2003-12-19 Thread agftech lists
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

RE: how to remove a ^M charaters from a variable

2003-12-19 Thread Tom Kinzer
-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.unixblo

Re: how to remove a ^M charaters from a variable

2003-12-19 Thread Douglas Lentz
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. This is an MS-DOSsy file, where each line is terminate

Re: how to remove a ^M charaters from a variable

2003-12-19 Thread Ajey
if its a unix file,.open in vi :%s/ctrl+v ctrl+m//g (where ctrl+v and ctrl+m gives the ^M character.) cheers On Fri, 19 Dec 2003, Douglas Lentz wrote: > 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 char