1

Why does grep not work with redirection?

view story
linux-howto

http://unix.stackexchange.com – 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 ? (HowTos)