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

The pattern NR%2 == 0 matches every second record and the action { print $0 } prints the whole record.

+

Negative patterns

+
awk '!/^#/ { print $1 }' <file>
+
+

Matches records not starting with #.

Access last fields in records

echo 'a b c d e f' | awk '{ print $NF $(NF-1) }'
 
-- cgit v1.2.3