On Aug 15, 2007, at 7:04 PM, Xavier Noria wrote:

perl -0777 -pi.bak -we 's{(<h1>)(.*?)(</h1>)}{$x = $2; $x =~ tr:-: :; "$1$x$3"}geis' *.html

A small improvement, groups are unnecessary because the elements are guaranteed not to have hyphens (in general they could, for instance in a class name, but in this case they don't):

perl -0777 -pi.bak -we 's{<h1>.*?</h1>}{$x = $&; $x =~ tr:-: :; $x} geis' *.html

-- fxn


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to