diff options
author | johannst <johannst@users.noreply.github.com> | 2021-07-29 21:33:05 +0000 |
---|---|---|
committer | johannst <johannst@users.noreply.github.com> | 2021-07-29 21:33:05 +0000 |
commit | 86bbee3264360de8ab5f8d2b277ac7d1045d0b80 (patch) | |
tree | 15e1f8862b44af3367de5ee55f4bc9b4415adee9 /tools/awk.html | |
parent | 7dd27f2a72395e51db76ee344ffba56279d5c6ff (diff) | |
download | notes-86bbee3264360de8ab5f8d2b277ac7d1045d0b80.tar.gz notes-86bbee3264360de8ab5f8d2b277ac7d1045d0b80.zip |
deploy: d086ca4c6179628546796e60bfade25be061f045
Diffstat (limited to 'tools/awk.html')
-rw-r--r-- | tools/awk.html | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/tools/awk.html b/tools/awk.html index 139ec07..3087bd7 100644 --- a/tools/awk.html +++ b/tools/awk.html @@ -223,6 +223,11 @@ For floats one can use <code>%N.Mf</code>, <code>N</code> is the total number in <code>M</code>.</p> </li> <li> +<p><code>sprintf("fmt", expr, ...)</code></p> +<p>Format the expressions according to the format string. Similar as <code>printf</code>, +but this is a function and return value can be assigned to a variable.</p> +</li> +<li> <p><code>strftime("fmt")</code></p> <p>Print time stamp formatted by <code>fmt</code>.</p> <ul> @@ -246,7 +251,7 @@ prints the whole record.</p> <h3><a class="header" href="#access-last-fields-in-records" id="access-last-fields-in-records">Access last fields in records</a></h3> <pre><code class="language-bash">echo 'a b c d e f' | awk '{ print $NF $(NF-1) }' </code></pre> -<p>Access last fields with arithmetic on the <code>NR</code> number of fields variable.</p> +<p>Access last fields with arithmetic on the <code>NF</code> number of fields variable.</p> <h3><a class="header" href="#capture-in-variables" id="capture-in-variables">Capture in variables</a></h3> <pre><code class="language-bash"># /proc/<pid>/status # Name: cat |