aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/tools
diff options
context:
space:
mode:
authorjohannst <johannes.stoelp@gmail.com>2021-07-28 23:48:28 +0200
committerjohannst <johannes.stoelp@gmail.com>2021-07-28 23:48:28 +0200
commit358833ec9c9c230c631d9bd5f29cb27d1cb273d1 (patch)
tree4ed02060498316324a9f9434b4c3c9b8fb294830 /src/tools
parent5c699dc60508a3fdfa25b1392a63cd053ab70b04 (diff)
downloadnotes-358833ec9c9c230c631d9bd5f29cb27d1cb273d1.tar.gz
notes-358833ec9c9c230c631d9bd5f29cb27d1cb273d1.zip
awk: fix type and add sprintf
Diffstat (limited to 'src/tools')
-rw-r--r--src/tools/awk.md7
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