I have a grep query:
grep "8=ABC\.4\.[24].*\|10=[0-9]+" output.txt |grep "35=8"| cut -d "|" -f 12 >redirect.txt
How do I execute the same from inside a python script? I know for a simple grep it works as follows:
sed_process = subprocess.Popen(['sed', sed_query,fopen], stdout=subprocess.PIPE) grep_query = "8=ABC\.4\.[24].*\|10=[0-9]+" grep_process = subprocess.Popen(['grep', grep_query], stdin=sed_process.stdout, stdout=subprocess.PIPE)
I'm confused as to how to combine 2 grep commands and a cut
command and redirect it to an output file?