Can you get a 1st occurence of a sting inside a huge text file?
For instance, I know that there will be 1 or more occurrences of a the
string ‘fail’ in a text file and I only want to get the first line
containing the ‘fail’ instead of getting every line with a fail. My
program reads over 100 files that may contain one or more ‘fail’ values.
Dir["//MYFile/*.txt"].each do |textfile|
getGrepOffense = textfile.grep(/fail/)
strOffense = getGrepOffense.join