Command Line

Regular Expression Basics (in a Unix Shell)

Regular expressions are a powerful concept used for searching, filtering, and manipulating text. This article aims to uncover the basics of using regular expressions to extract information from files while working in a Unix shell. To this end, this post covers the basics of working with grep, sed & awk.

Of course, most high-level programming languages have native support for regular expressions too, including Perl, Python, Ruby, Java, JavaScript, PHP etc. Sometimes it can be quicker to do some quick tests on a throw-away file at a shell prompt to test a theory than firing up an environment to create a test, so it might also be useful for developers.

Continue reading