awesome, it works! It's all starting to make some sense now. Thanks! baptiste On 29 Jun 2007, at 19:58, Axel Etzold wrote: >>> interesting_text.delete_if{|line| /(r|R)uby/.match==nil} >>> >>> removes all lines that don't contain the string Ruby or ruby, >> >> for some reason this doesn't work for me. I get an error message: >> ArgumentError: wrong number of arguments (0 for 1) >> >> >> if i replace this argument with something based on line numbers >> rather than regexp, it's fine. Is the Regexp wrong? > > You're right. The line should read: > > interesting_text.delete_if{|line| /(r|R)uby/.match(line)==nil} > >> >> >>> >>>> and change a value >>> old_value=1.2 >>> new_value=2.4 >>> >>> interesting_text.sub!(old_value.to_s,new_value.to_s) >>> >> >> I can't get that to work either : >> NoMethodError: private method `sub!' called for #<Array:0x7d180> >> > .. and again .. sub, gsub, sub!,gsub! are for Strings ... so > either: > > interesting_text=IO.readlines(file_name).to_s > interesting_text.sub!(old_value.to_s,new_value.to_s) > > or , if, each line is to be processed separately, > > interesting_text=IO.readlines(file_name) > > new_text=interesting_text.each{|line| > line.sub(old_value.to_s,new_value.to_s)} > > Sorry for the confusion. > > Best regards, > > Axel >> >> >>> >>> >>> Best regards, >>> >>> Axel >> >> >> The rest works fine, thanks again! >> >> baptiste >> >> > > -- > Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen! > Ideal f Modem und ISDN: http://www.gmx.net/de/go/smartsurfer >