Pipes and Filters
In one of its simplest forms, Pipes and Filters are available using a shell/console command line:
$ cat phone_numbers.txt | grep 303 | wc -l 3 $
Here a Linux command line is used to find how many contacts are in the fancy personal information manager, phone_numbers.txt, who have Colorado-based phone numbers. Admittedly this is not a very reliable way to implement that use case, but it does demonstrate how Pipes and Filters work:
1. The cat utility outputs the contents of phone_numbers.txt to what is called the standard output stream. Normally this stream is connected to the console. But when the | symbol is used, the output is piped to the input of the next utility.
2. Next, grep reads its input from the standard input stream, ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access