I usually use
command1 | command2 | command3
cat | sed '' | sed ''
cat | sed -e '' -e ''
cat | cat | cat
Basically a process that reads from a pipe can consume the data byte by byte as soon as they are available in the pipe. However, as long as the programs are using std io functions of the libc, like read, write etc, the libc will buffer the input/output of those programs depending on whether a program is writing to a terminal or not.
By default, if a program is writing to a terminal the libc will buffer the output line wise, if it goes not to a terminal it get's buffered block wise.
You can influence that behaviour using the
stdbuf command, like this:
stdbuf -oL cat | stdbuf -ioL sed '' | stdbuf -iL sed ''
I'm using a line based output buffer for the
cat command, a line based input and output buffer for the first
sed command and a line based input buffer for the last