2485 shaares
83 private links
83 private links
If you have a script that needs to keep up a single infinite pipeline but want to use sed (or grep) with it, simply use:
sed -u <mysedstuff>
to flush the pipes more often (usually means after every line)
or tail -f file | grep --line-buffered my_pattern
.
You can also use a command called stdbuf, see here https://unix.stackexchange.com/a/25378 in case you need it for other programs which do not support such a flushing mode.