Search code examples
unixpipegnu

Is there a gnu/unix command to both save a file without consuming stream?


I seem to faintly remember some unix command that allows you to save out put while piping to the next program.

Eg.

echo "hello world!"  \
| mystery_command hello.txt \
| sed -E "s/hello/goodbye/g" \
> goodbye.txt

Would both create a file called hello.txt with "hello world!" as contents. and a file called goodbye.txt with "goodbye world!" as contents.


Solution

  • I believe you are thinking of tee(1).