moreutils completes the shell's toolbox

Slashdot it! Delicious Share on Facebook Tweet! Digg!


The rude sounding pee command was also developed for use in pipes. This is the counterpart to the file-oriented tee command (Listing 11). tee outputs the output of a script or program to two files and STDOUT . pee , on the other hand, distributes the output to two pipes (so it can be used by another program) and omits it on STDOUT .

Listing 11

Pipes with pee

$ ./ | tee output1.txt output2.txt
$ ./ | pee "grep pattern" "gzip -c > output.gz"


The vipe program makes it possible to use editors between pipes (Listing 12). At first glance, this might seem to be of limited value since pipes connect the STDOUT channel of the first command to the default input of the second command. Sometimes it makes sense to edit data before the processing continues in order to save storage along the way. vipe first reads in the entire dataset, processes it, and then passes the results on after the editor is finished. As with vidir , vipe also evaluates the variables EDITOR and VISUAL as part of designating the editor.

Listing 12

Editing with vipe

$ man less | vipe | cat
LUTHER(1)        General Commands Manual        LUTHER(1)
       luther - opposite of pope
       Copyright (C) 1517-2016 by the Lutheriden
       Faked 2016 by Joerg Luther <>
                 Version 499: 28 Nov 2016        LUTHER(1)

Buy this article as PDF

Express-Checkout as PDF

Pages: 7

Price $0.99
(incl. VAT)

Buy Ubuntu User

Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content