Linux, terminal and Git

Stage 3 · Lesson 7 of 8

Columns with awk

Text tools

reads text one line at a time and splits each line into fields: $1 is the first, $2 the second, and so on. By default it splits on spaces; -F lets you choose another separator, such as a comma. That makes awk the quick tool for working with columns.

awk '{print $1}' access.log prints the first field of every line. awk -F, '$3 > 100' data.csv keeps only the rows where the third column is above 100. It can add up and count too: { total += $2 } END { print total } sums the second column. A small part of awk is enough to be productive.

Common trapwriting whole programs in awk when a short script would be clearer.

A question to check yourself, an AI practice session and 1 cheat sheet entry come when you add the roadmap to your account. Add it

Resources for this stage

Start with· follow one of these

Practise

  • Test regular expressions on sample text with a plain explanation of each part

  • Middle levels need grep, sort, uniq and find to locate the next password

Keep handy

  • The official jq manual with examples for every filter

  • Quick examples for find, sed, awk and friends when you forget the syntax

Mark this stage as not done?