perl.beginners
[Top] [All Lists]

RE: how to remove ^M character from every line

Subject: RE: how to remove ^M character from every line
From: Andrew Curry
Date: Mon, 3 Sep 2007 12:59:49 +0100
Newsgroups: perl.beginners

That will just remove all space (\s+$) at the end of the file. \r \n are
different 

-----Original Message-----
From: Beginner [mailto:dermot@xxxxxxxxxxxxxxxx] 
Sent: 03 September 2007 12:57
To: beginners@xxxxxxxx
Subject: Re: how to remove ^M character from every line

On 3 Sep 2007 at 17:26, divya wrote:
 
> A file generated on Windows machine is used on linux m/c while scripting.
> A sample line from the file is as shown:
> 
> //-------------------------------------------------------^M
> File name : project_name^M
> .....
> 
> Now in the perl script how can I remove ^M without running the command 
> dos2unix.
> 
> Note: Trying to split the line whenever ^ detected is not working.
> 
> Looking forward for your response.

I use s/\s+$//;

Dp.
 

--
To unsubscribe, e-mail: beginners-unsubscribe@xxxxxxxx For additional
commands, e-mail: beginners-help@xxxxxxxx http://learn.perl.org/



This e-mail is from the PA Group.  For more information, see
www.thepagroup.com.

This e-mail may contain confidential information.  Only the addressee is
permitted to read, copy, distribute or otherwise use this email or any
attachments.  If you have received it in error, please contact the sender
immediately.  Any opinion expressed in this e-mail is personal to the sender
and may not reflect the opinion of the PA Group.

Any e-mail reply to this address may be subject to interception or
monitoring for operational reasons or for lawful business practices.





<Prev in Thread] Current Thread [Next in Thread>