Cheyne Li wrote:
> I need "aaa=4" in the file instead of just print out
File.open('somefile', 'r+') do |file|
content = file.read.sub('aaa=100', 'aaa=4')
file.seek(0)
file.write(content)
}
Read more about File at
http://www.ruby-doc.org/core/classes/File.html
although this documentation isn't the easiest to follow.
Tor Erik
--
Posted via http://www.ruby-forum.com/.