Chapter Summary

The awk utility is a pattern-scanning and processing language that searches one or more files to see whether they contain records (usually lines) that match specified patterns. It processes lines by performing actions, such as writing the record to standard output or incrementing a counter, each time it finds a match.

An awk program consists of one or more lines containing a pattern and/or action in the following format:

pattern { action}

The pattern selects lines from the input. The awk utility performs the action on all lines that the pattern selects. If a program line does not contain a pattern, awk selects all lines in the input. If a program line does not contain an action, awk copies the selected lines to standard output.

An awk program can use variables, functions, arithmetic operators, associative arrays, control statements, and C's printf statement. Advanced awk programming takes advantage of getline statements to fine-tune input, and system statements to run OS X commands from within an awk program.

A Practical Guide to UNIX[r] for Mac OS[r] X Users
A Practical Guide to UNIX for Mac OS X Users
ISBN: 0131863339
EAN: 2147483647
Year: 2005
Pages: 234

Similar book on Amazon © 2008-2017.
If you may any questions please contact us: