diff options
author | johannst <johannes.stoelp@gmail.com> | 2021-07-28 23:48:28 +0200 |
---|---|---|
committer | johannst <johannes.stoelp@gmail.com> | 2021-07-28 23:48:28 +0200 |
commit | 358833ec9c9c230c631d9bd5f29cb27d1cb273d1 (patch) | |
tree | 4ed02060498316324a9f9434b4c3c9b8fb294830 /src/tools | |
parent | 5c699dc60508a3fdfa25b1392a63cd053ab70b04 (diff) | |
download | notes-358833ec9c9c230c631d9bd5f29cb27d1cb273d1.tar.gz notes-358833ec9c9c230c631d9bd5f29cb27d1cb273d1.zip |
awk: fix type and add sprintf
Diffstat (limited to 'src/tools')
-rw-r--r-- | src/tools/awk.md | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/tools/awk.md b/src/tools/awk.md index f8aa0a8..9ea4fc5 100644 --- a/src/tools/awk.md +++ b/src/tools/awk.md @@ -75,6 +75,11 @@ multiple times. Actions with those patterns are **executed exactly once**. For floats one can use `%N.Mf`, `N` is the total number including `.` and `M`. +- `sprintf("fmt", expr, ...)` + + Format the expressions according to the format string. Similar as `printf`, + but this is a function and return value can be assigned to a variable. + - `strftime("fmt")` Print time stamp formatted by `fmt`. @@ -101,7 +106,7 @@ prints the whole record. ```bash echo 'a b c d e f' | awk '{ print $NF $(NF-1) }' ``` -Access last fields with arithmetic on the `NR` number of fields variable. +Access last fields with arithmetic on the `NF` number of fields variable. ### Capture in variables ```bash |