awk doesn't convert strings to zero for $0
Hi. A user reported this to me in relation to some gawk documentation. I'm forwarding the actual issue on:
```sh
$ echo foo bar | nawk '{ print $("2foo") }'
bar
```
Fine and dandy. But now try this:
```sh
$ echo foo | nawk '{ print $("foo") }'
nawk: illegal field $(foo), name "foo "
input record number 1, file
source line number 1
```
Or even this:
```sh
$ echo foo | nawk '{ print $("0foo") }'
nawk: illegal field $(0foo), name "0foo "
input record number 1, file
source line number 1
```
关闭于 2025-01-07 2 条评论