ENCORE
DRAWKYB
| ESC | ! | @ | # | $ | % | ^ | & | * | ( | ) |___| + | ~ | | |
| | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | = | ` | \ |
| TAB | Q | W | E | R | T | Y | U | I | O | P | { | } |DEL|
| | | | | | | | | | | | [ | ] |RUB|
|CTRL|CAPS| A | S | D | F | G | H | J | K | L | : | " |RETURN|
| |LOCK| | | | | | | | | | ; | ' | |
| SHIFT | Z | X | C | V | B | N | M | < | > | ? | SHIFT |LIN|
| | | | | | | | | , | . | / | |FED|
| SPACE BAR |
PAGETURNER
PAUSE
LOOP1
LOOP2
$PROMPT$
DRAWFILE
keeptime
LOOPDRAWF
AANVANG
Connecting Commands with Pipelines
The standard output of one process can be the
standard input of another process. In UNIX
this is called a pipeline.
The symbol | is known as the pipe
symbol. The standard output of the
command to the left of the pipe ( | )
becomes the standard input to the
command on the right of pipe ( | ).
TYPSYM1
Pipe symbol usage practice, - 1.7.6.0.1
Please press the keys that tell UNIX
that the pipe | symbol is requested.
SHIFT
|
\
You will be assisted this time, but please
remember to use | for representing a pipe!
CONTINUE
No, you didn't hold the SHIFT key down.
Please try again, and be sure to hold the SHIFT key down
WHILE you press the | key.
No, you used the CONTROL key instead of the SHIFT
key.
Please try again, and be sure to hold the SHIFT key down
(not the CONTROL key) while you hold down the | key.
You entered some sort of CONTROL sequence, use instead
the | key!
Please try over, and be sure to hold the SHIFT key down
while you press the | key.
Sorry, that was not it. Please pay attention.
Look at the keyboard on your screen. Press BOTH the
lit keys at the same time.
DOREDIR1
SHIFT
|
\
Very good. You are now ready to proceed.
Connecting Commands with Pipelines
For example
To connect the output of one command to the
input of another command, all you do is tell
UNIX
command 1
^
the first
command
|
^
the | symbol
for connecting
two commands
command 2
^
the second command that
takes the output of the
first command as its
input
For example:
who | lpr
Connecting Commands with Pipelines
The command who | lpr takes the output of the
command who as input for the command lpr
To illustrate, note how the input from your terminal
is sent to your off-line printer (lpr) with the | .
Your Terminal
$PROMPT$ who | lpr
_____
| |__
/ | | /|
/________ / |
| | /
| PRINTER | /
|_________|/
_____
| |
WHO
| |
_____
| |
WHO
| |
_____
| |
WHO
| |
_____
Connecting Commands with Pipelines
Along with the redirection facilities,
the pipe facility is one of the most
important tools, permitting fast and easy
accomplishment of several tasks together.
Without the pipe facility, you would have
had to issue several separate commands.
Let's use the pipe facility.
DRDTE
date
PIP
|
DRWC
wc
UTERMINAL
TERMINAL
NEXT
$V1$
WC1
It is time to learn a new command. The command wc stands
for word count. It tells you 3 things:
1) The number of lines counted.
2) The number of words counted.
3) The number of characters counted including spaces.
For example, look at
the file keeptime:
Wed Nov 11 13:20:35 PDT 1988
Wed Nov 11 13:23:53 PDT 1988
$ wc keeptime
2 12 58 keeptime
There are 2 lines in keeptime.
2
There are 12 words in keeptime.
2
12
There are a total of 58 characters.
12
58
The file is keeptime.
58
keeptime
Using pipe command "date | wc" practice, - 1.7.6.0.2
Now we will give you a small demo so you can
watch wc in action. Enter the command:
date | wc
BEGIN
$PROMPT$
That is correct!
You've got it on the 2nd try.
Good, you understand the concept.
Please type date | wc
Please type date | wc
You will be assisted this time.
$PROMPT$
FORGET1
$ date | wc
Observe the process below the terminal!
HAPPI
Watch as the command date
is executed. Note that
its output DOES NOT appear
on the terminal screen.
Wed Nov 07 13:24:51 PDT 1988
Now the output from date is
sent through the pipe ... as
input to the wc command.
Wed Nov 07 13:24:51 PDT 1988
Wed Nov 07 13:24:51 PDT 1988
Wed Nov 07 13:24:51 PDT 1988
Wed Nov 07 13:24:51 PDT 1988
Wed Nov 07 13:24:51 PDT 1988
Wed Nov 07 13:24:51 PDT 1988
Wed Nov 07 13:24:51 PDT 1988
Wed Nov 07 13:24:51 PDT 1988
Wed Nov 07 13:24:51 PDT 1988
1 6 30
1 6 30
$PROMPT$
Thus you were able to
watch a pipe process!