I'm try to pipe chat log files to some speech output, and want to remove timestamps with cut and remove special characters with tr. Unfortunately, cut seems to halt when using it with tail -f in combination with tr:
//works
$ tail /path/to/chatlogs | cut -b18-
test
test
//works, too
$ tail /path/to/chatlogs | tr -C -d '[:alnum:][:cntrl:] '
test
test
// does not work
$ tail -f /path/to/chatlogs | tr -C -d '[:alnum:][:cntrl:] ' | cut -b18-
//no output
Why? How can I work around this?
It even hangs when piping two times into cut:
$ tail -f file | cut -b5- | cut -b5-
//no output
tail -fit might have to with its checking for new input only every 60 seconds or so. if it were to try toopen()the file all the time it would eat a lot of resources. trywhile <file; do :; donehere<fileis some regular, readable file, in the terminal and have a look attopin another terminal while it runs. or: >file; until read v; do : ; done <file. – mikeserv Dec 16 '15 at 11:47tailcommand waits for additional input because of the follow (-f) switch and never exits. – Lambert Dec 16 '15 at 11:52-fif you don't want it to wait for more output? – wurtel Dec 16 '15 at 11:55