aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools
diff options
context:
space:
mode:
authorjohannst <johannst@users.noreply.github.com>2022-09-23 18:47:33 +0000
committerjohannst <johannst@users.noreply.github.com>2022-09-23 18:47:33 +0000
commit0c31b8e434d634c81479bf396c752d1baaff7603 (patch)
tree6c40cd3d712262791f52257ec8ed50aa6dc3633d /tools
parent4e80ad2d34f307991562c364b157d1c7a502cd96 (diff)
downloadnotes-0c31b8e434d634c81479bf396c752d1baaff7603.tar.gz
notes-0c31b8e434d634c81479bf396c752d1baaff7603.zip
deploy: 47218d271f20b39610d5f63b3bc7dfc86642bdba
Diffstat (limited to 'tools')
-rw-r--r--tools/awk.html4
1 files changed, 4 insertions, 0 deletions
diff --git a/tools/awk.html b/tools/awk.html
index abcd01b..3234d89 100644
--- a/tools/awk.html
+++ b/tools/awk.html
@@ -233,6 +233,10 @@ but this is a function and return value can be assigned to a variable.</p>
</code></pre>
<p>The pattern <code>NR%2 == 0</code> matches every second record and the action <code>{ print $0 }</code>
prints the whole record.</p>
+<h3 id="negative-patterns"><a class="header" href="#negative-patterns">Negative patterns</a></h3>
+<pre><code class="language-bash">awk '!/^#/ { print $1 }' &lt;file&gt;
+</code></pre>
+<p>Matches records not starting with <code>#</code>.</p>
<h3 id="access-last-fields-in-records"><a class="header" href="#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>