Skip to content

Instantly share code, notes, and snippets.

@gelias
Created August 5, 2016 18:59
Show Gist options
  • Select an option

  • Save gelias/ab6e13d034b2a493f5c81991990e8321 to your computer and use it in GitHub Desktop.

Select an option

Save gelias/ab6e13d034b2a493f5c81991990e8321 to your computer and use it in GitHub Desktop.
#!/bin/ruby
full_filename = 'file.log'
text_to_search = 'string_to_search'
fileObj = File.new(full_filename, "r")
while (line = fileObj.gets)
if line.include? text_to_search
puts(line)
end
end
fileObj.close
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment