I'm trying to search for a string in all text and log files in the current directory. And if it finds a match, print the text or log file where the match was found. Is this possible, and how can I manipulate the code below to accomplish this task?
fiLe = open(logfile, "r")
userString = raw_input("Enter a string name to search: ")
for line in fiLe.readlines():
if userString in line:
print line