From: "Erik Bågfors" Date: 2002-03-10T03:34:23+09:00 Subject: Re: Text stuff and appending to a file On Fri, 2002-03-08 at 15:19, Bob wrote: > I have the following that works: > > # open a file and read it > input = File.open(ARGV[0], "r") > > # create a file to append data found from the input file > logfile = File.new("badwords.txt", "w+").close Why do you close this? Also. For append you should you "a" and not "w+" > # search for a word and print the entire line > while line = gets() > if /bob/i =~ line > print line > end > end > > I would like the lines that it finds with "bob" to print to the > console and append to the logfile. > And what's the problem?? --- logfile.puts line puts line --- added in the "if"-statement should do it! /Erik -- Erik B�gfors | erik@bagfors.nu Supporter of free software | GSM +46 733 279 273 fingerprint: 6666 A85B 95D3 D26B 296B 6C60 4F32 2C0B 693D 6E32