m-chrzan.xyz
aboutsummaryrefslogtreecommitdiff
path: root/awk.md
blob: 8e8499a3869e0e3a5d58abc204fbc87a385c6220 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
# 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).