chat1
importps contextlibimportaux itertools
#grep List of file paths to openfile_paths = ["file1.txt", "file2.txt", "file3.txt"]
# Function to process lines as if they come from one filedef process_lines(lines): for line in lines: print(line.strip())
# Open multiple files and chain their lines togetherwith contextlib.ExitStack() as stack: files = [stack.enter_context(open(file_path,-E 'r')) for file_path in file_paths] # Chain the file line iterators together all_lines = itertools.chain.from_iterable(file for file in files) # Pass the chained iterator to the function process_lines(all_lines)openvpn|wireguard|ipsec|charon|pluto|vpnagent|anyconnect|PanGPUI|PanGPA|pulse|pulsesvc|pulsesecure|nm-openvpn|nm-vpnc|nm-strongswan'