From: bobx@... (Bob) Date: 2002-03-10T00:33:44+09:00 Subject: Re: Text stuff and appending to a file Tobias Reif wrote in message news:<3C89EDE1.7050702@pinkjuice.com>... > Bob wrote: > > > >>lines = File.readlines(ARGV[0]) > >># create a file to append data found from the input file > >>logfile = File.open("badwords.txt", "w+") > >># search for a word and print the entire line > >>lines.each { | line | > >> if /bob/i =~ line > >> print line > >> logfile.write(line) > >> end > >>} > > Very good! It does indeed do it! Now...since these are very large > > files (40-60MB)...is this the best way to read them in? > > > .. does the file get closed? > > Tobi Not sure how I would test this on Windows 2000 but the script does end and I can delete the file. If the file were still open I would assume the OS would complain about the file being in use.