Question: Below is a Python program that searches a log file for selected characters. A sample log file is attached below the code. Your job is
Below is a Python program that searches a log file for selected characters. A sample log file is attached below the code. Your job is to test this program and add some features. The features you need to add include:
Create a user interface. The user should be able to enter the name of the file to be searched.
.The user should also be able to enter a search character expression. Allow for selected output.
The user should be able to specify selected output only, such as IP addresses.
********** import re # Select a file filename = "auth.log" # Select a search term txt = "Invalid" # Check the file for the search term line by line with open(filename) as f: for line in f: match = re.search(txt, line) if match: print(match.string)
*********
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
