diff options
Diffstat (limited to 'src/tools/awk.md')
-rw-r--r-- | src/tools/awk.md | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/tools/awk.md b/src/tools/awk.md index 7ffe9a8..5fc3184 100644 --- a/src/tools/awk.md +++ b/src/tools/awk.md @@ -102,6 +102,12 @@ awk 'NR%2 == 0 { print $0 }' <file> The pattern `NR%2 == 0` matches every second record and the action `{ print $0 }` prints the whole record. +### Negative patterns +```bash +awk '!/^#/ { print $1 }' <file> +``` +Matches records not starting with `#`. + ### Access last fields in records ```bash echo 'a b c d e f' | awk '{ print $NF $(NF-1) }' |