[ILUG] ^M quickie

Michael Turley samplecode at yahoo.com
Fri May 5 04:22:23 IST 2000


I wrote:

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

A nice Perl way (almost entirely stolen from the Perl
cookbook) is (you can lose the g I reckon as there
should only be one ^M per line):

#!/usr/local/bin/perl

local $^I = '.old';
local @ARGV = glob("*.htm");
while (<>) {
s/\r//g;
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