Windows Command line: pipe example

Self-tutoring about computer science: the tutor mentions a key element of command line thinking.

At the command line (Windows or Li|U|nix), a pipe is often shown as | and sends the first command’s output as input to the next command.

Let’s imagine, for instance, at the Windows command prompt, you’ve a long file and want to find the string “hello” in it. At the command line you could type

type longfile.txt | find /N “hello”

The type command will output the file’s contents to the pipe; find /N will receive them from the pipe as input, then display, with line numbers, those lines that contain “hello”.

Jack of Oracle Tutoring by Jack and Diane, Campbell River, BC.

Leave a Reply