I'm trying to create a python script able to search with one or more parameters in a file lines but after many test I'm not able to do this This is my python code:
for log_files in os.listdir(path):
files = os.path.join(path, log_files)
strng = open(files)
for lines in strng.readlines():
lines = re.sub('"','', lines)
if (sys.argv[2] and sys.argv[3]) in lines:
# if sys.argv[3] in lines:
# print("Matched !!")
lines=log_files+"__"+lines
print(lines)
content_array.append(lines)
The code shows me a result which means that it did not take into consideration the two parameters in the if statement