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.

180 <strong>G<strong>AWK</strong></strong>: <strong>Effective</strong> <strong>AWK</strong> <strong>Programming</strong>-W lint[=fatal]--lint[=fatal]Warns about constructs that are dubious or nonportable to other awk implementations.Some warnings are issued when gawk first reads your program.Others are issued at runtime, as your program executes. With an optionalargument of ‘fatal’, lint warnings become fatal errors. This may be drastic,but its use will certainly encourage the development of cleaner awk programs.With an optional argument of ‘invalid’, only warnings about things that areactually invalid are issued. (This is not fully implemented yet.)Some warnings are only printed once, even if the dubious constructs they warnabout occur multiple times in your awk program. Thus, when eliminating problemspointed out by ‘--lint’, you should take care to search for all occurrencesof each inappropriate construct. As awk programs are usually short, doing sois not burdensome.-W lint-old--lint-oldWarns about constructs that are not available in the original version of awkfrom Version 7 Unix (see Section A.1 [Major Changes Between V7 and SVR3.1],page 257).-W non-decimal-data--non-decimal-dataEnable automatic interpretation of octal and hexadecimal values in input data(see Section 10.1 [Allowing Nondecimal Input Data], page 169).-W posix--posixCaution: This option can severely break old programs. Use with care.Operates in strict POSIX mode. This disables all gawk extensions (just like‘--traditional’) and adds the following additional restrictions:• \x escape sequences are not recognized (see Section 2.2 [Escape Sequences],page 25).• Newlines do not act as whitespace to separate fields when FS is equal to asingle space (see Section 3.2 [Examining Fields], page 39).• Newlines are not allowed after ‘?’ or ‘:’ (see Section 5.12 [ConditionalExpressions], page 92).• The synonym func for the keyword function is not recognized (seeSection 8.2.1 [Function Definition Syntax], page 153).• The ‘**’ and ‘**=’ operators cannot be used in place of ‘^’ and ‘^=’ (seeSection 5.5 [Arithmetic Operators], page 81, and also see Section 5.7 [AssignmentExpressions], page 83).• Specifying ‘-Ft’ on the command-line does not set the value of FS to bea single TAB character (see Section 3.5 [Specifying How Fields Are Separated],page 43).• The locale’s decimal point character is used for parsing input data (seeSection 2.9 [Where You Are Makes A Difference], page 35).

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

Saved successfully!

Ooh no, something went wrong!