Tobias Reif <tobiasreif / pinkjuice.com> 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.