Hi,

At Sat, 7 Dec 2002 04:52:16 +0900,
Daniel Carrera wrote:
> I want to read each line, process it, print that to another file, and then
> rename the output file.  This is how I'd do it in Perl:
> 
> open ORIG, "<$filename";
> open TEMP, ">.$$.tmp";
> 
> while (<ORIG>) {
>     s/<pre>/<code>/g;
>     s/<\/pre>/<\/code>/g;
>     print TEMP
> }
> close ORIG;
> close TEMP;
> 
> rename ".$$.tmp", "$filename";

$ ruby -pi -e "gsub!(%r[<(/?)pre>], '<\1code>')" filename

-- 
Nobu Nakada