Robert Klemme
4/3/2007 5:00:00 PM
On 03.04.2007 18:56, phil.swenson@gmail.com wrote:
> well I *THOUGHT* I knew how to do it, here's my first crack at it:
>
> file_name = base_config_path + '/Caching/tangosol-
> coherence.xml'
> File.open(file_name, File::RDWR).each{ |line|
> if line.gsub!(/30890/, port.to_s)
> puts "tangosol port overridden with %d" % port
> break
> end
> }
>
>
> The gsub doesn't modify the line, guess it just modifies the string.
Exactly.
> How do I actually modify the file itself?
Read it, modify it, write it. Or use ruby -pi.bak ...
robert