answersLogoWhite

0

The pipe construct as symbolized by '|' originated in the Unix operating system and is one of a set of input/output (I/O) redirectors, the others being '>' and '<' (without the single quotes). This concept was also carried over to Microsoft's DOS and Windows operating system command lines (COMMAND.COM, CMD.EXE and today, Powershell). The general idea is that command line programs either take in "input" or send "output" to some destination, usually your screen which is considered "standard out" (abbreviated as stdio). Your keyboard is typically "standard in" (abbreviated as stdin). Using the pipe in operating systems the support the concept, it is possible to have the output of one program (it's stdout) "piped" to the input of another program (the other program's stdin) for further processing.

For example, if you run a command line program that outputs multiple lines of text that scroll out of view and you're specifically looking for a particular word (known as a "character string" or "string"), you can run your command and then pipe it's output to the input of the 'grep' command which will only display any output that matches your string. The command would look something like this:

mycommand | grep "sausages"

The stdout of 'mycommand' is piped to the stdin of 'grep'. The end result is that the only lines that will be displayed on your screen from 'mycommand' are the ones that contain the string "sausages".

User Avatar

Wiki User

16y ago

What else can I help you with?