Buy the book!
|[Top]||[Contents]||[Index]||[ ? ]|
This file documents
awk, a program that you can use to select
particular records in a file and perform operations upon them.
Foreword Some nice words about this Web page. Preface What this Web page is about; brief history and acknowledgments. 2. Getting Started with
A basic introduction to using
awk. How to run an
program. Command-line syntax.
3. Regular Expressions All about matching things using regular expressions. 4. Reading Input Files How to read files and manipulate fields. 5. Printing Output How to print using
awk. Describes the
printfstatements. Also describes redirection of output.
6. Expressions Expressions are the basic building blocks of statements. 7. Patterns, Actions, and Variables Overviews of patterns and actions. 8. Arrays in
The description and use of arrays. Also includes array-oriented control statements. 9. Functions Built-in and user-defined functions. 10. Internationalization with
gawkto speak your language.
11. Advanced Features of
Stuff for advanced users, specific to
How to run
13. A Library of
awkprograms with complete explanations.
A. The Evolution of the
The evolution of the
gawkunder various operating systems.
C. Implementation Notes Notes about
gawkextensions and possible future work.
D. Basic Programming Concepts A very quick intoduction to programming concepts. Glossary An explanation of some unfamiliar terms. GNU General Public License Your right to copy and distribute
GNU Free Documentation License The license for this Web page. Index Concept and Variable Index.
The history of
1.0 A Rose by Any Other Name What name to use to find
1.1 Using This Book Using this Web page. Includes sample input files that you can use. 1.2 Typographical Conventions The GNU Project and This Book Brief history of the GNU project and this Web page. How to Contribute Helping to save the world. Acknowledgments 2.1 How to Run
How to run
gawkprograms; includes command-line syntax.
2.1.1 One-Shot Throwaway
Running a short throwaway
awkWithout Input Files
Using no input files (input from terminal instead). 2.1.3 Running Long Programs Putting permanent
awkprograms in files.
2.1.5 Comments in
Adding documentation to
2.1.6 Shell-Quoting Issues More discussion of shell quoting issues. 2.2 Data Files for the Examples Sample data files for use in the
awkprograms illustrated in this
2.3 Some Simple Examples A very simple example. 2.4 An Example with Two Rules A less simple one-line example using two rules. 2.5 A More Complex Example A more complex example. 2.6
awkStatements Versus Lines
Subdividing or combining statements into lines. 2.7 Other Features of
2.8 When to Use
When to use
gawkand when to use other things.
3.1 How to Use Regular Expressions 3.2 Escape Sequences How to write nonprinting characters. 3.3 Regular Expression Operators 3.4 Using Character Lists What can go between `[...]'. 3.5
gawk-Specific Regexp Operators
Operators specific to GNU software. 3.6 Case Sensitivity in Matching How to do case-insensitive matching. 3.7 How Much Text Matches? How much text matches. 3.8 Using Dynamic Regexps 4.1 How Input Is Split into Records Controlling how data is split into records. 4.2 Examining Fields An introduction to fields. 4.3 Nonconstant Field Numbers 4.4 Changing the Contents of a Field 4.5 Specifying How Fields Are Separated The field separator and how to change it. 4.5.1 Using Regular Expressions to Separate Fields Using regexps as the field separator. 4.5.2 Making Each Character a Separate Field Making each character a separate field. 4.5.3 Setting
FSfrom the Command Line
FSfrom the command-line.
4.5.4 Field-Splitting Summary Some final points and a summary table. 4.6 Reading Fixed-Width Data Reading constant width data. 4.7 Multiple-Line Records Reading multi-line records. 4.8 Explicit Input with
Reading files under explicit program control using the
getlinewith No Arguments
getlinewith no arguments.
getlineinto a Variable
getlineinto a variable.
getlinefrom a File
getlinefrom a file.
getlineinto a Variable from a File
getlineinto a variable from a file.
getlinefrom a Pipe
getlinefrom a pipe.
getlineinto a Variable from a Pipe
getlineinto a variable from a pipe.
getlinefrom a Coprocess
getlinefrom a coprocess.
getlineinto a Variable from a Coprocess
getlineinto a variable from a coprocess.
4.8.9 Points to Remember About
Important things to know about
4.8.10 Summary of
5.1 The The 5.2 Examples of Simple examples of 5.3 Output Separators The output separators and how to change them. 5.4 Controlling Numeric Output with Controlling Numeric Output With
printfStatements for Fancier Printing
5.5.1 Introduction to the
Syntax of the
5.5.2 Format-Control Letters Format-control letters. 5.5.3 Modifiers for
Format-specification modifiers. 5.5.4 Examples Using
Several examples. 5.6 Redirecting Output of
How to redirect output to multiple files and pipes. 5.7 Special File Names in
File name interpretation in
gawkallows access to inherited
`&&' ("and") and `!' ("not").
5.7.1 Special Files for Standard Descriptors Special files for I/O. 5.7.2 Special Files for Process-Related Information Special files for process information. 5.7.3 Special Files for Network Communications Special files for network communications. 5.7.4 Special File Name Caveats Things to watch out for. 5.8 Closing Input and Output Redirections Closing Input and Output Files and Pipes. 6.1 Constant Expressions String, numeric and regexp constants. 6.1.1 Numeric and String Constants Numeric and string constants. 6.1.2 Octal and Hexadecimal Numbers What are octal and hex numbers. 6.1.3 Regular Expression Constants Regular Expression constants. 6.2 Using Regular Expression Constants When and how to use a regexp constant. 6.3 Variables Variables give names to values for later use. 6.3.1 Using Variables in a Program Using variables in your programs. 6.3.2 Assigning Variables on the Command Line Setting variables on the command-line and a summary of command-line syntax. This is an advanced method of input. 6.4 Conversion of Strings and Numbers The conversion of strings to numbers and vice versa. 6.5 Arithmetic Operators Arithmetic operations (`+', `-', etc.) 6.6 String Concatenation Concatenating strings. 6.7 Assignment Expressions Changing the value of a variable or a field. 6.8 Increment and Decrement Operators Incrementing the numeric value of a variable. 6.9 True and False in
What is "true" and what is "false". 6.10 Variable Typing and Comparison Expressions How variables acquire types and how this affects comparison of numbers and strings with `<', etc. 6.11 Boolean Expressions Combining comparison expressions using boolean operators `||' ("or"),
6.12 Conditional Expressions Conditional expressions select between two subexpressions under control of a third subexpression. 6.13 Function Calls A function call is an expression. 6.14 Operator Precedence (How Operators Nest) How various operators nest. 7.1 Pattern Elements What goes into a pattern. 7.1.1 Regular Expressions as Patterns Using regexps as patterns. 7.1.2 Expressions as Patterns Any expression can be used as a pattern. 7.1.3 Specifying Record Ranges with Patterns Pairs of patterns specify record ranges. 7.1.4 The
Specifying initialization and cleanup rules. 184.108.40.206 Startup and Cleanup Actions How and why to use BEGIN/END rules. 220.127.116.11 Input/Output from
I/O issues in BEGIN/END rules. 7.1.5 The Empty Pattern The empty pattern, which matches every record. 7.2 Using Shell Variables in Programs How to use shell variables with
7.3 Actions What goes into an action. 7.4 Control Statements in Actions Describes the various control statements in detail. 7.4.1 The
Conditionally execute some
Loop until some condition is satisfied. 7.4.3 The
Do specified action while looping until some condition is satisfied. 7.4.4 The
Another looping statement, that provides initialization and increment clauses. 7.4.5 The
Immediately exit the innermost enclosing loop. 7.4.6 The
Skip to the end of the innermost enclosing loop. 7.4.7 The
Stop processing the current input record. 7.4.8 Using
Stop processing the current file. 7.4.9 The
Stop execution of
7.5 Built-in Variables Summarizes the built-in variables. 7.5.1 Built-in Variables That Control
Built-in variables that you change to control
7.5.2 Built-in Variables That Convey Information Built-in variables where
awkgives you information.
Ways to use
8.1 Introduction to Arrays 8.2 Referring to an Array Element How to examine one element of an array. 8.3 Assigning Array Elements How to change an element of an array. 8.4 Basic Array Example Basic Example of an Array 8.5 Scanning All Elements of an Array A variation of the
forstatement. It loops through the indices of an array's existing elements.
deletestatement removes an element from an array.
8.7 Using Numbers to Subscript Arrays How to use numbers as subscripts in
8.8 Using Uninitialized Variables as Subscripts Using Uninitialized variables as subscripts. 8.9 Multidimensional Arrays Emulating multidimensional arrays in
8.10 Scanning Multidimensional Arrays Scanning multidimensional arrays. 8.11 Sorting Array Values and Indices with
Sorting array values and indices. 9.1 Built-in Functions Summarizes the built-in functions. 9.1.1 Calling Built-in Functions How to call built-in functions. 9.1.2 Numeric Functions Functions that work with numbers, including
9.1.3 String-Manipulation Functions Functions for string manipulation, such as
18.104.22.168 More About `\' and `&' with
More than you want to know about `\' and `&' with
9.1.4 Input/Output Functions Functions for files and shell commands. 9.1.5 Using
gawk's Timestamp Functions
Functions for dealing with timestamps. 9.1.6 Bit-Manipulation Functions of
Functions for bitwise operations. 9.1.7 Using
gawk's String-Translation Functions
Functions for string translation. 9.2 User-Defined Functions Describes User-defined functions in detail. 9.2.1 Function Definition Syntax How to write definitions and what they mean. 9.2.2 Function Definition Examples An example function definition and what it does. 9.2.3 Calling User-Defined Functions Things to watch out for. 9.2.4 The
Specifying the value a function returns. 9.2.5 Functions and Their Effects on Variable Typing How variable types can change at runtime. 10.1 Internationalization and Localization 10.2 GNU
Features for the programmer. 10.4 Translating
Features for the translator. 10.4.1 Extracting Marked Strings Extracting marked strings. 10.4.2 Rearranging
awk-level portability issues.
10.5 A Simple Internationalization Example A simple i18n example. 10.6
gawkCan Speak Your Language
gawkis also internationalized.
11.1 Allowing Nondecimal Input Data Allowing nondecimal input data. 11.2 Two-Way Communications with Another Process Two-way communications with another process. 11.3 Using
gawkfor Network Programming
gawkfor network programming.
gawkwith BSD Portals
gawkwith BSD portals.
11.5 Profiling Your
How to run
12.2 Command-Line Options Command-line options and their meanings. 12.3 Other Command-Line Arguments Input file names and variable assignments. 12.4 The
Searching directories for
12.5 Obsolete Options and/or Features Obsolete Options and/or features. 12.6 Undocumented Options and Features 12.7 Known Bugs in
13.1 Naming Library Function Global Variables How to best name private global variables in library functions. 13.2 General Programming Functions that are of general use. 13.2.1 Implementing
nextfileas a Function
Two implementations of a
13.2.2 Assertions A function for assertions in
13.2.3 Rounding Numbers A function for rounding if
sprintfdoes not do it correctly.
13.2.4 The Cliff Random Number Generator 13.2.5 Translating Between Characters and Numbers Functions for using characters as numbers and vice versa. 13.2.6 Merging an Array into a String A function to join an array into a string. 13.2.7 Managing the Time of Day A function to get formatted times. 13.3 Data File Management Functions for managing command-line data files. 13.3.1 Noting Data File Boundaries A function for handling data file transitions. 13.3.2 Rereading the Current File A function for rereading the current file. 13.3.3 Checking for Readable Data Files Checking that data files are readable. 13.3.4 Treating Assignments as File Names Treating assignments as file names. 13.4 Processing Command-Line Options A function for processing command-line arguments. 13.5 Reading the User Database Functions for getting user information. 13.6 Reading the Group Database Functions for getting group information. 14.1 Running the Example Programs How to run these examples. 14.2 Reinventing Wheels for Fun and Profit Clones of common utilities. 14.2.1 Cutting out Fields and Columns The
14.2.2 Searching for Regular Expressions in Files The
14.2.3 Printing out User Information The
14.2.4 Splitting a Large File into Pieces The
14.2.5 Duplicating Output into Multiple Files The
14.2.6 Printing Nonduplicated Lines of Text The
14.2.7 Counting Things The
14.3 A Grab Bag of
14.3.1 Finding Duplicated Words in a Document Finding duplicated words in a document. 14.3.2 An Alarm Clock Program An alarm clock. 14.3.3 Transliterating Characters A program similar to the
14.3.4 Printing Mailing Labels Printing mailing labels. 14.3.5 Generating Word-Usage Counts A program to produce a word usage count. 14.3.6 Removing Duplicates from Unsorted Text Eliminating duplicate entries from a history file. 14.3.7 Extracting Programs from Texinfo Source Files Pulling out programs from Texinfo source files. 14.3.8 A Simple Stream Editor 14.3.9 An Easy Way to Use Library Functions A wrapper for
awkthat includes files.
A.1 Major Changes Between V7 and SVR3.1 The major changes between V7 and System V Release 3.1. A.2 Changes Between SVR3.1 and SVR4 Minor changes between System V Releases 3.1 and 4. A.3 Changes Between SVR4 and POSIX
New features from the POSIX standard. A.4 Extensions in the Bell Laboratories
New features from the Bell Laboratories version of
A.5 Extensions in
gawkNot in POSIX
The extensions in
gawknot in POSIX
A.6 Major Contributors to
The major contributors to
What is in the
B.1.1 Getting the
How to get the distribution. B.1.2 Extracting the Distribution How to extract the distribution. B.1.3 Contents of the
What is in the distribution. B.2 Compiling and Installing
gawkunder various versions of Unix.
B.2.2 Additional Configuration Options Other compile-time options. B.2.3 The Configuration Process How it's all supposed to work. B.3 Installation on Other Operating Systems B.3.1 Installing
gawkon an Amiga
B.3.3 Installation on PC Operating Systems Installing and Compiling
gawkon MS-DOS and OS/2.
B.3.3.1 Installing a Prepared Distribution for PC Systems Installing a prepared distribution. B.3.3.2 Compiling
gawkfor PC Operating Systems
gawkfor MS-DOS, Win32, and OS/2.
gawkon PC Operating Systems
gawkon MS-DOS, Win32 and OS/2.
gawkIn The Cygwin Environment
Building and running
B.3.4 How to Compile and Install
How to compile
How to install
How to run
B.3.4.4 Building and Using
gawkon VMS POSIX
Alternate instructions for VMS POSIX. B.4 Unsupported Operating System Ports Systems whose ports are no longer supported. B.4.1 Installing
gawkon the Atari ST
gawkon the Atari ST
gawkon the Atari ST
gawkon a Tandem
B.5 Reporting Problems and Bugs B.6 Other Freely Available
Other freely available
C.1 Downward Compatibility and Debugging How to disable certain
C.2 Making Additions to
Making Additions To
C.2.1 Adding New Features Adding code to the main body of
gawkto a New Operating System
gawkto a new operating system.
C.3 Adding New Built-in Functions to
Adding new built-in functions to
C.3.1 A Minimal Introduction to
A brief look at some
C.3.2 Directory and File Operation Built-ins A example of new functions. C.3.2.1 Using
What the new functions will do. C.3.2.2 C Code for
The code for internal file operations. C.3.2.3 Integrating the Extensions How to use an external extension. C.4 Probable Future Extensions New features that may be implemented one day. D.1 What a Program Does The high level view. D.2 Data Values in a Computer A very quick intro to data types. D.3 Floating-Point Number Caveats Stuff to know about floating-point numbers.
|webmaster donations bookstore||delorie software privacy|
|Copyright © 2003 by The Free Software Foundation||Updated Jun 2003|