Skip to content

Instantly share code, notes, and snippets.

@shayanzare007
Created November 21, 2016 12:07
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shayanzare007/44fa85270eadf4ac16dacc4265cb9a2f to your computer and use it in GitHub Desktop.
Save shayanzare007/44fa85270eadf4ac16dacc4265cb9a2f to your computer and use it in GitHub Desktop.
search in text file
#!/usr/bin/ruby
File.open("License.txt") do |f| #open file
f.each_line do |line|
text = [/sh/, /123/] #array for searching
if line =~ text[0] || text[1] #searching in file
puts "[+] Found License: #{line}" #puts founding word
else
puts "[+] License is not found!"
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment