21.07.2015 Views

GAWK: Effective AWK Programming

GAWK: Effective AWK Programming

GAWK: Effective AWK Programming

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Chapter 6: Patterns, Actions, and Variables 115NRUnlike most of the variables described in this section, assigning a value to NF hasthe potential to affect awk’s internal workings. In particular, assignments to NFcan be used to create or remove fields from the current record: See Section 3.4[Changing the Contents of a Field], page 41.The number of input records awk has processed since the beginning of theprogram’s execution (see Section 3.1 [How Input Is Split into Records], page 36).NR is incremented each time a new record is read.PROCINFO #The elements of this array provide access to information about the running awkprogram. The following elements (listed alphabetically) are guaranteed to beavailable:PROCINFO["egid"]The value of the getegid system call.PROCINFO["euid"]The value of the geteuid system call.PROCINFO["FS"]This is "FS" if field splitting with FS is in effect, or it is"FIELDWIDTHS" if field splitting with FIELDWIDTHS is in effect.PROCINFO["gid"]The value of the getgid system call.PROCINFO["pgrpid"]The process group ID of the current process.PROCINFO["pid"]The process ID of the current process.PROCINFO["ppid"]The parent process ID of the current process.PROCINFO["uid"]The value of the getuid system call.PROCINFO["version"]The version of gawk. This is available from version 3.1.4 and later.On some systems, there may be elements in the array, "group1" through"groupN" for some N. N is the number of supplementary groups that the processhas. Use the in operator to test for these elements (see Section 7.2 [Referringto an Array Element], page 120).This array is a gawk extension. In other awk implementations, or if gawk is incompatibility mode (see Section 11.2 [Command-Line Options], page 177), it isnot special.RLENGTH The length of the substring matched by the match function (see Section 8.1.3[String-Manipulation Functions], page 132). RLENGTH is set by invoking thematch function. Its value is the length of the matched string, or −1 if no matchis found.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!