[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Probs with 'tail -f foo | awk ...'



>Since upgrading from Slack 2xxx to Debian 1.1 the following
>construction doesn't work any more :-(
>
>adson$ cat > test << EOF
>>A 1
>>B 1
>>C 1
>>EOF
>
>adson$ tail -f test | awk '$1 =="B"'
>
>There should be the output "B 1" on stdout now, but nothing
>happens. It works if I don't use the f-switch, but this is not what I
>need.
>
>Any hints?!

I'd guess `tail -f' is buffering its output, and so not writing to the
pipe until it has a full block.

Or, awk is buffering input and waiting for more to come out of tail.

Or both.

Try with a much bigger `test' file and see what happens.

-- 
Richard Kettlewell
http://www.elmail.co.uk/staff/richard/                    richard@elmail.co.uk
               If my head is in the clouds, it is because I am standing on the
                                                        shoulders of giants...


Reply to: