050913:awk中几个内置变量的man说明,感觉英文记..
时间:2005-09-13 来源:yuyuyou
NR ------------------- The total number of input records seen so far.
OFMT ------------------- The output format for numbers, "%.6g", by default.
OFS ------------------- The output field separator, a space by default.
NF ------------------- The number of fields in the current input record.
NR ------------------- The total number of input records seen so far.
OFMT ------------------- The output format for numbers, "%.6g", by default.
OFS ------------------- The output field separator, a space by default.
ORS ------------------- The output record separator, by default a newline.
FILENAME ------------------- The name of the current input file. If no files are speci-
fied on the command line, the value of FILENAME is "-".
However, FILENAME is undefined inside the BEGIN block
(unless set by getline).
FNR ------------------- The input record number in the current input file.
FS ------------------- The input field separator, a space by default. See Fields,
ARGC ------------------- The number of command line arguments (does not include
options to gawk, or the program source).
ARGIND ------------------- The index in ARGV of the current file being processed.
ARGV ------------------- Array of command line arguments. The array is indexed from
0 to ARGC - 1. Dynamically changing the contents of ARGV
can control the files used for data.
ENVIRON------------------- An array containing the values of the current environment.
The array is indexed by the environment variables, each
element being the value of that variable (e.g., ENVI-
RON["HOME"] might be /home/arnold). Changing this array
does not affect the environment seen by programs which gawk
spawns via redirection or the system() function.
ERRNO------------------- If a system error occurs either doing a redirection for
getline, during a read for getline, or during a close(),
then ERRNO will contain a string describing the error. The
value is subject to translation in non-English locales.
FIELDWIDTHS ------------------- A white-space separated list of fieldwidths. When set,
gawk parses the input into fields of fixed width, instead
of using the value of the FS variable as the field separa-
tor.