Ryan Frantz wrote:
> 
>>-----Original Message-----
>>From: Ankur Gupta [mailto:[EMAIL PROTECTED]
>>Sent: Friday, September 23, 2005 2:48 PM
>>To: Dave Adams
>>Cc: beginners perl
>>Subject: Re: Looking for perl scripts to remove ^M
>>
>>On 9/23/2005 11:28 PM Dave Adams wrote:
>>
>>
>>>Sometimes I get perl scripts that were developed on windows and then
>>>brought over to UNIX and the scripts contain all the pesky
>>>metacharacters of ^M and excessive blank lines.
>>>
>>>Does anyone have a simple script to clean these files up or
> 
> suggestions?
> 
>>If you are using vi/vim as your editor then this is the good way to
> 
> deal
> 
>>with it..
>>
>>:%s/.$//
> 
> 
> This could also remove _any_ single characters just before the EOL that
> aren't ^M.  I know it's rare, but I've come across half-DOS, half-UNIX
> text files like this where some EOLs had the DOS EOL char and some
> didn't (I have no idea why other than someone was previously trying to
> remove them...).
> 

The same can be applied, you just should be more specific...

:%s/^M//

To make the '^M' hit Ctrl+v then M.

http://danconia.org

-- 
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