Go to the previous, next section.
To tell each command in a string of commands to get its input from the command before it, type the following:
firstcommand | secondcommand | lastcommand
Replace lastcommand with the command that is to get its input from secondcommand, and replace secondcommand with the command that is to get its input from firstcommand.
The following example runs the program myprog
and sends its
output to the grep
command. It then causes the grep
command to look for all occurrences of the string `counter' in
myprog
's output and sends the grep
command's output (all
the lines of myprog
that contain the counter string) to the
more
command. The more
command then sends the grep
command's
output to the terminal screen (which is the more
command's standard
output).
myprog | grep counter | more
Go to the previous, next section.