Small, Fast, & Simple

April 23, 2015



Unix introduced the concept of chaining program outputs to the inputs of other programs via pipes. For example, the commands cat, grep, and cut are very simple and focused, but using pipes they can be composed together to do non-simple searches.

cat file.txt | grep 2015-04-23 | cut -f5

This example finds the fifth tab-delimed field of lines in file.txt matching the given date. Unix-like systems have a large toolbox of small programs that can be connected together. Often I’ve used pipes to write a program that would have been non-trivial in a scripting language.