linux - How do I redirect input typed in a terminal running 'tail -f' and 'grep'? -
i have device uses serial line interface user, accepting input , printing traces in return. however, these traces verbose , of time i'm watching them through terminal running commands
tail -f serial.log | grep <myfilter> however, when need input data, have switch terminal reading (and logging) serial output comes device.
is there way in same terminal? want type "grepped" terminal , have characters reach device.
you can run tail command in background:
{ tail --pid=$! -f serial.log | grep <myfilter>; } & this tail log , print matches terminal, still able type commands in usual (to ps1 prompt back, press return). stop command, run:
kill -9 $! as long have not started other background tasks! if have other background tasks run, can store value of $! after starting tail command, , use later kill it.
Comments
Post a Comment