I'm using the following commandtail -f /mydir/myfile |  grep searchterm >> outfileWithout the -f it works fine, but with the -f, which I need, nothing is written to the file. The following outputs to the console just finetail -f /mydir/myfile |  grep searchtermWhat do I need to do in order to get my command to correctly write out to a file?
Tail -f piped through grep not outputing to file, but outputs to console
grep;tail;stdout
If you have GNU grep:tail -f /mydir/myfile |  grep --line-buffered searchterm >> outfileWhich will write every line, for a performance penalty. Alternatively, wait for more output. If you're killing the processes, just kill the tail process and the buffer should flush before grep exits.  