I'm doing os.system
to tail for a live file and grep
for a string
How can I execute something when the grep succeeds?
For example
cmd= os.system(tail -f file.log | grep -i abc)
if (cmd):
#Do something and continue tail
Is there any way I can do this? It will only come to the if
block when the os.system statement is completed.