i want to convert from os.system into subprocess the following
os.system("egrep 'Invalid user' /home/bits/Desktop/Assessment/auth.log | cut -d ' ' -f 11 >tempfile.txt ")
it works but when i write the same statement using subprocess it will create an empty file , does some1 know why and how to resolve that ? thx
a1=subprocess.Popen(["egrep \"Invalid users\" /home/bits/Desktop/Assessment/auth.log"],shell=True,stdout=subprocess.PIPE) ### instead of /home/bits/Desktop/Assessment/auth.log please modify with your full path of auth.log
a2=subprocess.Popen(["cut -d \" \" -f 11 > /home/bits/Desktop/Assessment/rezolvare/tempfile.txt"],shell=True,stdin=a1.stdout,stdout=subprocess.PIPE)