21.07.2015 Views

GAWK: Effective AWK Programming

GAWK: Effective AWK Programming

GAWK: Effective AWK Programming

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Chapter 11: Running awk and gawk 181• The fflush built-in function is not supported (see Section 8.1.4[Input/Output Functions], page 143).If you supply both ‘--traditional’ and ‘--posix’ on the command line,‘--posix’ takes precedence. gawk also issues a warning if both options aresupplied.-W profile[=file]--profile[=file]Enable profiling of awk programs (see Section 10.5 [Profiling Your awkPrograms], page 173). By default, profiles are created in a file named‘awkprof.out’. The optional file argument allows you to specify a differentfile name for the profile file.When run with gawk, the profile is just a “pretty printed” version of the program.When run with pgawk, the profile contains execution counts for eachstatement in the program in the left margin, and function call counts for eachfunction.-W re-interval--re-intervalAllows interval expressions (see Section 2.3 [Regular Expression Operators],page 27) in regexps. Because interval expressions were traditionally not availablein awk, gawk does not provide them by default. This prevents old awkprograms from breaking.-W source program-text--source program-textAllows you to mix source code in files with source code that you enter on thecommand line. Program source code is taken from the program-text. Thisis particularly useful when you have library functions that you want to usefrom your command-line programs (see Section 11.4 [The <strong>AWK</strong>PATH EnvironmentVariable], page 183).-W use-lc-numeric--use-lc-numericThis option forces the use of the locale’s decimal point character when parsingnumeric input data (see Section 2.9 [Where You Are Makes A Difference],page 35).-W version--versionPrints version information for this particular copy of gawk. This allows you todetermine if your copy of gawk is up to date with respect to whatever the FreeSoftware Foundation is currently distributing. It is also useful for bug reports(see Section B.5 [Reporting Problems and Bugs], page 280).As long as program text has been supplied, any other options are flagged as invalid witha warning message but are otherwise ignored.In compatibility mode, as a special case, if the value of fs supplied to the ‘-F’ option is‘t’, then FS is set to the TAB character ("\t"). This is true only for ‘--traditional’ andnot for ‘--posix’ (see Section 3.5 [Specifying How Fields Are Separated], page 43).

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

Saved successfully!

Ooh no, something went wrong!