Field

noun

say it: “FEELD” /fild/

One piece of a line of text, between separators such as spaces or commas, counted from 1.

What is a field in a line of text?

A field is one piece of a line, cut at a separator such as a space or a comma. Fields are numbered from 1: in awk, $1 is the first field, $7 the seventh and $NF the last. cut -f picks fields by the same numbers.

awk '{ print $1, $9 }' access.log | head -n 2
# 203.0.113.5 200
# 203.0.113.5 200

In a sentence

  • “$NF is always the last field of the line, however many there are.”
  • “In the web log the ninth field is the status code, so awk prints it with $9.”

Level: Apprentice · More Unix terms at this level

Updated

In other subjects