Extracting and displaying data with awk: Cheat sheet download

Extracting and displaying data with awk

Get our awk cheat sheet.

human head, brain outlined with computer hardware background
Image by : 



Get the newsletter

Join the 85,000 open source advocates who receive our giveaway alerts and article roundups.

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


About the author

photo of Jim Hall
Jim Hall - Jim Hall is an open source software developer and advocate, probably best known as the founder and project coordinator for FreeDOS. Jim is also very active in the usability of open source software, as a mentor for usability testing in GNOME Outreachy, and as an occasional adjunct professor teaching a course on the Usability of Open Source Software. From 2016 to 2017, Jim served as a director on the GNOME Foundation Board of Directors. At work, Jim is Chief Information Officer in local...