Janis schrieb:
>> "out.txt" file is empty, nothing was printed to the screen. Where did
>> the output redirection go?
>
> In an I/O buffer that hasn't got filled enough to be flushed
> before you aborted the process.
>
> To understand, try...
>
> while true; do date; sleep 1; done | head -3 | awk '{print $4}' >
> out.txt
>
> (BTW, this is off-topic here; comp.unix.shell is more appropriate.)
Actually, it's awk, not shell setting (or any other program that
buffers, like grep).
I solved it in gawk by adding {fflush()}:
iostat dm-1 -d 1 -k | awk '/dm-1/{print $3" "$4}{fflush()}' >output.st
For grep, BTW, the option is "--line-buffered".
--
Tomasz Chmielewski
http://wpkg.org


|