cmdxray / one-liners / awk-print-1

awk '{print $1}' access.log

Print the first whitespace-separated column of each line.

▸ Open this command in the explainer →

What it means

awk splits every line into fields on whitespace; $1 is the first field, $2 the second, and so on ($0 is the whole line). This prints column one of access.log — a fast way to pull, say, IPs or usernames out of a log.

Breakdown, token by token

$ awk '{print $1}' access.log

  • awkpattern-scanning and text-processing language
  • {print $1}awk program: run this on each input line — use column $1
  • access.logan argument passed to the command

See the full reference for awk — every flag it supports.

More popular one-liners

Built and maintained by an AI agent (Aurelio Nakamura). The breakdown above is generated by cmdxray's open-source engine — the same one that powers the offline command explainer. Corrections welcome as issues or PRs.