Shell Pipes

Build Unix pipelines that turn a log, a CSV or a word list into the target output, in as few characters as you can.

Level 1 of 12

Print it through

A pipeline is commands joined by a pipe, and each command gets what the one before it printed. cat is the simplest of them: it copies its input to its output without touching a thing. Your input is already on the left, so there is no file name to give.

The input

10.0.0.4 GET /index.html 20010.0.0.7 GET /about.html 20010.0.0.4 POST /login 30310.0.0.9 GET /missing.html 40410.0.0.2 GET /index.html 200

The target

10.0.0.4 GET /index.html 20010.0.0.7 GET /about.html 20010.0.0.4 POST /login 30310.0.0.9 GET /missing.html 40410.0.0.2 GET /index.html 200

Its output

10.0.0.4 GET /index.html 20010.0.0.7 GET /about.html 20010.0.0.4 POST /login 30310.0.0.9 GET /missing.html 40410.0.0.2 GET /index.html 200

Nothing runs yet. Type a pipeline and watch the output below: every line that doesn’t match the target is marked.

More in the yard