Skip to content
Archive of posts filed under the shell category.

Smart ranges in awk

Using flags to select ranges in awk

Sorting by paragraph

This comes up in discussions and forums from time to time. Basically, the input is composed of paragraphs (ie, separated by runs of empty lines), and each paragraph has a specific value somewhere in it. The goal is to sort the text "by paragraph", according to this key, and the resulting output should still consist […]

Working with blocks in awk

Recognize multiline blocks of text using awk

Before and after match in awk

Get lines that are n lines before or after a match.

Run a command on all files in a hierarchy

Something that everybody needs to do sooner or later.