March 2018
Beginner to intermediate
416 pages
9h 24m
English
CONVFMT is used to control number-to-string conversion—that is, when a number is converted to a string, AWK will use the CONVFMT format to decide how to print the values. CONVFMT has its default value set as %.6g, which implies a total of six characters, including both sides of a dot in a number. This variable was added in POSIX-compliant AWK. We can print the value contained in the format specifier CONVFMT variable with the help of the following command:
$ awk 'BEGIN { print "Conversion Format =", CONVFMT}'
The output of the execution of this command is as follows:
Conversion Format = %.6g
When we use g as the format specifier, it counts all the characters on both sides of the dot. For example, %.4g means a total of 4 characters ...
Read now
Unlock full access