[ILUG] ^M quickie

Michael Turley samplecode at yahoo.com
Thu May 4 23:52:13 IST 2000


I wrote:
> Does anyone know of a quick way to get rid of ^M
from
> multiple files of the same format?

Here's how to do it in Perl (almost entirely robbed
from Perl Cookbook). I forgot that ^M is equivalent to
\r for perl regex.

#!/usr/local/bin/perl

local $^I = '.old';
local @ARGV = glob("*.c");
while (<>) {
s/\r//;
print;
} continue {close ARGV if eof}


=====
Mr. Michael Turley
Gracious winner, Generous lover, All round great guy.

__________________________________________________
Do You Yahoo!?
Send instant messages & get email alerts with Yahoo! Messenger.
http://im.yahoo.com/




More information about the ILUG mailing list