Skip to Content
Small, Sharp Software Tools
book

Small, Sharp Software Tools

by Brian P. Hogan
June 2019
Intermediate to advanced
328 pages
7h 27m
English
Pragmatic Bookshelf
Content preview from Small, Sharp Software Tools

Advanced Processing with awk

awk lets you process text in a number of ways. You can use it to extract fields in a file, calculate totals, and even change the order of the output of a file. awk is a command-line utility, but it’s also a scripting language with loops, variables, and conditionals.

Much like sed, awk works slightly differently depending on the version installed on your operating system. On Ubuntu, the awk command that ships out-of-the-box is missing a few features, so install a more full-featured version before moving on:

 $ ​​sudo​​ ​​apt​​ ​​install​​ ​​gawk

Let’s explore awk by using some data from the 2010 U.S. Census that shows population by state. You can find the full dataset in the book’s code download, but you’ll use ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

The VimL Primer

The VimL Primer

Benjamin Klein
What Employees Want Most in Uncertain Times

What Employees Want Most in Uncertain Times

Kristine W. Powers, Jessica B.B. Diaz

Publisher Resources

ISBN: 9781680507003Errata Page