Linux

awk

SafeField processing

awk '{print $1}' <file>

Splits lines into fields to extract/aggregate; great for logs.

Examples

  • awk '{print $1}' access.log | sort | uniq -cCount requests by IP

Syntax

awk '<pattern>{<action>}' <file>

Before you run it

Read-only output.

Related commands

The same reference, with no signal at all

Every command and flow from this site, held on your device and searchable with no connection. Free to install, no ads.

Get it free on the App Store