top command with redirection works fine:
top > top.log
Now I want to use grep to filter a certain line:
top | grep "my_program" > top.log
But the log file will remain empty. But grep delivers an output when using
top | grep "my_program"
my_program has to be replaced by a running program to see some output.
Why does my approach not work ? And how can I fix it ?