I am working on a short script which tails a logfile. it should be possible to filter the output with regex and split by /t if necessary.
I wrote something like this in perl some years ago but have to change it to python
perl-code-sniplet:
open(FILE,"tail -F logfile | grep -v something | ");
while(<FILE>){
my @lineparts = split(/\t/,$_);
...
do something else
...
}
I've already tried Popen different varieties (logger.sh contains tail -F on an remote server via ssh)
cmd = subprocess.Popen("./logger.sh").communicate()
for line in cmd.stdout.readline():
test = line
if re.match('.*ERR.*', test):
print "ERROR"
But all I get is an output on stdout and I cannot manipulate it (never printed "ERROR")
Anyone got any ideas?