Using the 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"
Where 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 ?
-b
option totop
or usingps
instead. – Lev Levitsky Sep 26 '12 at 19:38-b
did not solve my problem, but solved some encoding problems. Thank you. – Sep 26 '12 at 20:09