Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm trying to follow a log file and want to extract a field from it. I've tried

tail foo.txt | cut -f 5

and this works, but if I try to follow changes via

tail -f foo.txt | cut -f 5

nothing is printed, even when there are changes to the file.

Any suggestions or comments about why this is happening?

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

BASH FAQ entry #9: "What is buffering? Or, why does my command line produce no output: tail -f logfile | grep 'foo bar' | awk ..."

share|improve this answer
    
Is there a way to force unbuffering with cut? Incidentally, I switched to using awk, and the buffering problem went away. –  jonderry Apr 22 '11 at 0:34
    
unbuffer will force unbuffering in almost any program. –  Ignacio Vazquez-Abrams Apr 22 '11 at 0:37
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.