I want to run a command like this
grep -w 1 pattern <(tail -f mylogfile.log)
basically from a python script i want to monitor a log file for a specific string and continue with the python script as soon as i found that.
I am using os.system(), but that is hanging. The same command in bash works good.
I have a very old version of python (v2.3) and so don’t have sub-process module.
do we have a way to acheive this
In Python 2.3, you need to use
subprocessfrom SVNTo be explicit, you need to install it from the SVN link above.
You need to call this with
/bin/bash -cdue to the shell redirection you’re usingEDIT
If you want to solve this with
os.system(), just wrap the command in/bin/bash -csince you’re using shell redirection…