diff options
Diffstat (limited to 'tools/awk.html')
-rw-r--r-- | tools/awk.html | 4 |
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 }' <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> |