Created
November 21, 2016 12:07
-
-
Save shayanzare007/44fa85270eadf4ac16dacc4265cb9a2f to your computer and use it in GitHub Desktop.
search in text file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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