When sed is redirected to a file, it buffers it's output. So, unless you waited for the script to execute long enough (almost 6 minutes by my estimates) to fill the stdout buffer at least once, you won't see anything.
However if you do the same thing without the 2 sec delay e.g. while :; do echo hello; echo; done | sed '/^$/d' > /tmp/f you will notice that /tmp/f fills quite rapidly. Doug. Aubrey Li wrote:
Hi list, A silly question here: A simple list I wrote to test ===================== $ cat test #!/usr/bin/sh # while true; do echo hello echo "" sleep 2 done ===================== if I run it as the following: $ ./test > tmp.txt of course I can get something from tmp.txt file And if I run it as [aubrey-...@~]./test | sed '/^$/d' hello hello hello Blank line will be filtered by sed, but if I run it as [aubrey-...@~]./test | sed '/^$/d' > tmp.txt Nothing is in the tmp.txt. What's wrong I did? Thanks, -Aubrey _______________________________________________ tools-discuss mailing list tools-discuss@opensolaris.org
_______________________________________________ tools-discuss mailing list tools-discuss@opensolaris.org