Skip to content

Commit 228e61f

Browse files
changed text explaining NF
1 parent a14c120 commit 228e61f

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

gnu_awk.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,11 @@ DESCRIPTION
8585
* `$1` contains the first field text
8686
* default input field separator is one or more of continuous space, tab or newline characters
8787
* `$2` contains the second field text and so on
88-
* `$NF` points to last field
89-
* `NF` is built-in variable and can be used in expressions
90-
* `$(NF-1)` points to second last field and so on
88+
* `$(2+3)` result of expressions can be used, this one evaluates to `$5` and hence gives fifth field
89+
* similarly if variable `i` has value `2`, then `$(i+3)` will give fifth field
90+
* `NF` is a built-in variable which contains number of fields in the current record
91+
* so, `$NF` will give last field
92+
* `$(NF-1)` will give second last field and so on
9193

9294
```bash
9395
$ cat fruits.txt

0 commit comments

Comments
 (0)