m-chrzan.xyz
aboutsummaryrefslogtreecommitdiff
path: root/awk.md
blob: 2c0e1fa009937f4f0c371dace613ac15a630172a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# Awk

## Basics

    awk program file

Program is ;-separated pattern-action statements.

    /pattern/ { action }
    # e.g. (apostrophes to not interpolate shell vars
    awk '/tt/ { print $1 }' awk.md

`$0` is whole line, `$1`, `$2`, ... are fields separated by `FS` (by default,
whitespace).

Set `FS` with `-F <sepstring>`