Я намагаюся вести журнал файлів, grepщо триває, tailі отримати nслово з рядка. Приклад файлу:
$ cat > test.txt <<EOL
Beam goes blah
John goes hey
Beam goes what?
John goes forget it
Beam goes okay
Beam goes bye
EOL
^C
Тепер, якщо я роблю tail:
$ tail -f test.txt
Beam goes blah
John goes hey
Beam goes what?
John goes forget it
Beam goes okay
Beam goes bye
^C
Якщо я grepце tail:
$ tail -f test.txt | grep Beam
Beam goes blah
Beam goes what?
Beam goes okay
Beam goes bye
^C
Але якщо я awkце grep:
$ tail -f test.txt | grep Beam | awk '{print $3}'
Нічого, як би довго я не чекав. Я підозрюю, що це пов'язане з тим, як працює потік.
У когось є підказки?