On Wednesday 19 June 2002 11:54 am, Todd Holloway wrote:
> what if one needed to make several changes through out the file?
>
>  ARGV.replace(['Makefile'])
>  ARGF.each_line do |line|
>    print line.sub(/blah1/, "blah2")
>    print line.sub(/blah3/, "blah4")
>  end
>
> this seems to give me the correct substitutions...but twice as
> many lines :)

Because you have two prints for each line. Why not something like:

ARGV.replace(['Makefile'])
 ARGF.each_line do |line|
   line.gsub!(/blah1/, "blah2")
   line.gsub!(/blah3/, "blah4")
    print line
 end

-- 
Ned Konz
http://bike-nomad.com
GPG key ID: BEEA7EFE