This reads the file only to the first appearance of 'string'
and processes it line by line - not reading the whole file at once.
def file_contains_regexp?(filename,regexp)
File.foreach(filename) do |line|
return true if line =~ regexp
end
return false
end