Filtering programs

When we establish long pipelines, we sometimes want to add an extra "link" into the pipeline to reformat or filter the data in some way before passing it on to the next program, and we may find that there are no programs available to us on the system that filter the text in exactly the way we need.

We may therefore wish to use something with a bit more power; we'll look at the sed and AWK programming language interpreters, both of which are specified by POSIX. They are ideal tools to write short one-line programs dedicated to filtering text streams in novel ways.

We can't completely explain sed and AWK here, but we'll give some examples that will demonstrate the sort of tasks for which they are ideal. Like many other commands ...

Get Bash Quick Start Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.