Things you don't know about GAWK
All features which are there in AWK are available as default in GAWK. In addition to these features, there are some other features of GAWK that essentially require a mention—they are covered in this section.These are not interrelated, so moving from one feature to another will be like picking up a random tool from a box filled with essential utilities.
Reading non-decimal input
The non-decimal values are like octal numbers or hexadecimal numbers. We cannot use these values to print their decimal equivalent with AWK; GAWK provides the option, --non-decimal-data,
to print non-decimal values in the output.Octal values need to be prefixed with 0
and hexadecimal values need to be prefixed with 0x
for reading in GAWK.For example, the following gawk
command can be used to convert hexadecimal input to the corresponding decimal output,as follows:
$ echo 088 | gawk --non-decimal-data '{ printf "Decimal equivalent of octal %s is : %d \n", $1, $1 }'
The output of the previous...