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.

112 <strong>G<strong>AWK</strong></strong>: <strong>Effective</strong> <strong>AWK</strong> <strong>Programming</strong>IGNORECASE #If IGNORECASE is nonzero or non-null, then all string comparisons and all regularexpression matching are case independent. Thus, regexp matching with ‘~’ and‘!~’, as well as the gensub, gsub, index, match, split, and sub functions,record termination with RS, and field splitting with FS, all ignore case whendoing their particular regexp operations. However, the value of IGNORECASEdoes not affect array subscripting and it does not affect field splitting whenusing a single-character field separator. See Section 2.6 [Case Sensitivity inMatching], page 32.LINT #OFMTIf gawk is in compatibility mode (see Section 11.2 [Command-Line Options],page 177), then IGNORECASE has no special meaning. Thus, string and regexpoperations are always case-sensitive.When this variable is true (nonzero or non-null), gawk behaves as if the ‘--lint’command-line option is in effect. (see Section 11.2 [Command-Line Options],page 177). With a value of "fatal", lint warnings become fatal errors. Witha value of "invalid", only warnings about things that are actually invalid areissued. (This is not fully implemented yet.) Any other true value prints nonfatalwarnings. Assigning a false value to LINT turns off the lint warnings.This variable is a gawk extension. It is not special in other awk implementations.Unlike the other special variables, changing LINT does affect the production oflint warnings, even if gawk is in compatibility mode. Much as the ‘--lint’and ‘--traditional’ options independently control different aspects of gawk’sbehavior, the control of lint warnings during program execution is independentof the flavor of awk being executed.This string controls conversion of numbers to strings (see Section 5.4 [Conversionof Strings and Numbers], page 79) for printing with the print statement.It works by being passed as the first argument to the sprintf function (seeSection 8.1.3 [String-Manipulation Functions], page 132). Its default value is"%.6g". Earlier versions of awk also used OFMT to specify the format for convertingnumbers to strings in general expressions; this is now done by CONVFMT.OFS This is the output field separator (see Section 4.3 [Output Separators], page 60).It is output between the fields printed by a print statement. Its default valueis " ", a string consisting of a single space.ORSRSThis is the output record separator. It is output at the end of every printstatement. Its default value is "\n", the newline character. (See Section 4.3[Output Separators], page 60.)This is awk’s input record separator. Its default value is a string containing asingle newline character, which means that an input record consists of a singleline of text. It can also be the null string, in which case records are separatedby runs of blank lines. If it is a regexp, records are separated by matches of theregexp in the input text. (See Section 3.1 [How Input Is Split into Records],page 36.)The ability for RS to be a regular expression is a gawk extension. In most otherawk implementations, or if gawk is in compatibility mode (see Section 11.2

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

Saved successfully!

Ooh no, something went wrong!