bug-gawk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bug-gawk] fatal: cannot assign to arbitrary elements of SYMTAB


From: Peng Yu
Subject: Re: [bug-gawk] fatal: cannot assign to arbitrary elements of SYMTAB
Date: Wed, 17 Apr 2019 22:12:18 -0500

>> $ awk -e 'BEGIN { SYMTAB["foo"] = "1"; print SYMTAB["foo"] }'
>> awk: cmd. line:1: fatal: cannot assign to arbitrary elements of SYMTAB
>
> Why is this program better than:
>
> bash-4.2$ ./gawk -e 'BEGIN { SYMTAB["foo"] = "1"; print foo }'
> 1

You assume that the header must be a valid awk variable name. That is
a too stringent condition. Not all headers satisfy this condition.

Also, people might want to specify the column name in the command line
via `-v`. It is not possible to do so using your command.

> Why? How is it better than my revised version above which continues
> to work fine? What's the usage case for assigning to arbitrary variable
> names that are never used in the program?

-- 
Regards,
Peng



reply via email to

[Prev in Thread] Current Thread [Next in Thread]