>_ IzzyLab

Topic breakdown

awk automatically splits each line into fields by whitespace and numbers them: $1, $2, $3, while $0 is the whole line. The action in curly braces runs for each input line, so it's enough to print the right field with the print operator on each line. Mental model: awk is a "for each line, do X" loop, where you describe X in terms of column numbers; the result is redirected to a file.

What's checked

  1. ages in /root/ages.txt in the original order

What it looks like