Extracting and displaying data with awk

Get our awk cheat sheet.
274 readers like this.
Getting started with SQL


If you need to extract data from files, or simply display data in a new way, you need a script. AWK is a scripting language that does exactly that in a straightforward way. AWK (usually written as just "awk") originates from the 1970s and has become a standard feature on any Unix system. Named after its inventors—Aho, Weinberger, and Kernighan—awk can tackle most jobs that you throw at it.

GNU awk ("gawk") is the free software version of awk. It's pretty easy to write scripts using gawk to grab data from text files and transform that data for use elsewhere. Gawk scripts can use regular expressions or other patterns to select data and use a host of standard functions to manipulate data and print output.

Use this handy cheat sheet to quickly reference most of gawk's features. There's more to gawk than can fit in one cheat sheet, but this shows the most commonly used features. To learn more about gawk, view the gawk manual page on your system (man gawk) or visit the GNU Awk User’s Guide


photo of Jim Hall
Jim Hall is an open source software advocate and developer, best known for usability testing in GNOME and as the founder + project coordinator of FreeDOS.

Comments are closed.

Creative Commons LicenseThis work is licensed under a Creative Commons Attribution-Share Alike 4.0 International License.