INNER CODE UNIT · Python
search_content
AabyssZG/FindEverything · FindEverything-notqdm.py:26
def search_content(file_path, content):
matching_lines = []
try:
with open(file_path, 'r', encoding='utf-8', errors='ignore') as file:
for line_num, line in enumerate(file, 1):
try:
if content in line:
matching_lines.append((line_num, line))
except UnicodeDecodeError as e:
print(f"[-] Unicode decode error file {file_path}, line {line_num}: {e}")
print()
return matching_lines
except:
print(f"[-] Error file {file_path}")
print()
def write_to_file(output_file, file_path, matching_lines):
with open(output_file, 'a', encoding='utf-8') as f: