pawk
pawk copied to clipboard
Invoke pawk from a python script?
Is it possible to invoke pawk from a python script, without using subprocess.run?
I am imagining something like:
import pawk
my_pawk_program = ' .... '
results = pawk.run(my_pawk_program)
You could probably replicate the invocation here https://github.com/alecthomas/pawk/blob/e4e8716973800ea215d7cec976374c1c770046e6/pawk.py#L244-L253
Something like:
# error handling skipped
pawk.run(["pawk", "/etc/"], io.StringIO("/tmp\n/dev\n/etc/passwd\n"), sys.stdout)
Or maybe you can figure out how to call this method directly https://github.com/alecthomas/pawk/blob/e4e8716973800ea215d7cec976374c1c770046e6/pawk.py#L163