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

Removing newlines in text files

A task that comes up every so often, for some reason

“Zero or more”

This usually comes up in a form similar to "I'm running this code: $ echo "foobar 123" | sed 's/[0-9]*/blah/' blahfoobar 123 but I don't get the expected result!" (which they think should be "foobar blah"). The result they get is instead as shown above. Why is that? Remember that the star quantifier "*" means […]

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.