I want to run the following bash command from within my python script
tail input.txt | grep <pattern>
I have written the following lines
bashCommand = "tail input.txt | grep <pattern>'"
process = subprocess.Popen(bashCommand.split(), stdout=subprocess.PIPE)
But this ends up simply printing out the tail of the input file and not the pattern I am trying to grep. How do I circumvent this?