tee can split pipe so that you write to the standard output (most commonly the next stage of the pipe) and to a file (or named pipe) simultaneously.
tee [ -ai ] file_list
The following options may be used to control how tee functions.
-a Appends the output to an existing file. If the file does not exist it will be created. Normally an existing file would be overwritten.
-i Ignore interrupts. If you press the Delete key, tee ignores the interrupt signal sent to it and continues processing.
The following argument may be passed to the tee command.
file_list One or more files where tee writes copies of the input.
Example: Sort a file and save its output, then, print first unique 10 lines.
sort somefile.txt | tee sorted_file.txt | uniq -c | head 10 > top10.txt