From 0c31b8e434d634c81479bf396c752d1baaff7603 Mon Sep 17 00:00:00 2001 From: johannst <johannst@users.noreply.github.com> Date: Fri, 23 Sep 2022 18:47:33 +0000 Subject: deploy: 47218d271f20b39610d5f63b3bc7dfc86642bdba --- tools/awk.html | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'tools') 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 }' <file> +</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> -- cgit v1.2.3