| Title and Copyright Information |
| About This Manual |
| Audience |
| New and Changed Features |
| Organization |
| Related Documentation |
| Reader's Comments |
| Conventions |
| 1 | Finding Information with Regular Expressions and the grep Command |
| 1.1 | Forming Regular Expressions |
| 1.1.1 | Basic Regular Expressions |
| 1.1.2 | Extended Regular Expressions |
| 1.1.3 | Matching Multiple Occurrences of a Regular Expression |
| 1.1.4 | Matching Only Selected Characters |
| 1.1.5 | Specifying Multiple Regular Expressions |
| 1.1.6 | Special Collating Considerations in Regular Expressions |
| 1.2 | Using the grep Command |
| 2 | Matching Patterns and Processing Information with awk |
| 2.1 | Running the awk Program |
| 2.2 | Printing in awk |
| 2.3 | Using Variables in awk |
| 2.3.1 | Simple Variables |
| 2.3.2 | Field Variables |
| 2.3.3 | Array Variables |
| 2.3.4 | Built-In awk Variables |
| 2.4 | More About Using Regular Expressions as Patterns |
| 2.5 | Using Relational Expressions and Combined Expressions as Patterns |
| 2.6 | Using Pattern Ranges |
| 2.7 | Actions in awk |
| 2.8 | Using Operators in an Action |
| 2.9 | Using Functions Within an Action |
| 2.10 | Using Control Structures in awk |
| 2.11 | Performing Actions Before or After Processing the Input |
| 2.12 | Concatenating Strings |
| 2.13 | Redirection and Pipes |
| 3 | Editing Files with the sed Editor |
| 3.1 | Overview of the sed Editor |
| 3.2 | Running the sed Editor |
| 3.3 | Selecting Lines for Editing |
| 3.4 | Summary of sed Commands |
| 3.5 | String Replacement |
| 4 | Creating Input Language Analyzers and Parsers |
| 4.1 | How the Lexical Analyzer Works |
| 4.2 | Writing a Lexical Analyzer Program with lex |
| 4.3 | The lex Specification File |
| 4.3.1 | Defining Substitution Strings |
| 4.3.2 | Rules |
| 4.3.2.1 | Regular Expressions |
| 4.3.2.2 | Matching Rules |
| 4.3.2.2.1 | Using Wildcard Characters to Match a String |
| 4.3.2.2.2 | Finding Strings Within Strings |
| 4.3.2.3 | Actions |
| 4.3.2.3.1 | Null Action |
| 4.3.2.3.2 | Using the Same Action for Multiple Expressions |
| 4.3.2.3.3 | Printing a Matched String |
| 4.3.2.3.4 | Finding the Length of a Matched String |
| 4.3.2.3.5 | Getting More Input |
| 4.3.2.3.6 | Returning Characters to the Input |
| 4.3.3 | Using or Overriding Standard Input/Output Routines |
| 4.3.4 | End-of-File Processing |
| 4.3.5 | Passing Code to the Generated Program |
| 4.3.6 | Start Conditions |
| 4.4 | Generating a Lexical Analyzer |
| 4.5 | Using lex with yacc |
| 4.6 | Creating a Parser with yacc |
| 4.6.1 | The main and yyerror Functions |
| 4.6.2 | The yylex Function |
| 4.7 | The Grammar File |
| 4.7.1 | Declarations |
| 4.7.1.1 | Defining Global Variables |
| 4.7.1.2 | Start Symbols |
| 4.7.1.3 | Token Numbers |
| 4.7.2 | Grammar Rules |
| 4.7.2.1 | Null String |
| 4.7.2.2 | End-of-Input Marker |
| 4.7.2.3 | Actions in yacc Parsers |
| 4.7.3 | Programs |
| 4.7.4 | Guidelines for Using Grammar Files |
| 4.7.4.1 | Using Comments |
| 4.7.4.2 | Using Literal Strings |
| 4.7.4.3 | Guidelines for Formatting the Grammar File |
| 4.7.4.4 | Using Recursion in a Grammar File |
| 4.7.4.5 | Errors in the Grammar File |
| 4.7.5 | Error Handling by the Parser |
| 4.7.5.1 | Providing for Error Correcting |
| 4.7.5.2 | Clearing the Look-Ahead Token |
| 4.8 | Parser Operation |
| 4.8.1 | The shift Action |
| 4.8.2 | The reduce Action |
| 4.8.3 | Ambiguous Rules and Parser Conflicts |
| 4.9 | Turning on Debug Mode |
| 4.10 | Creating a Simple Calculator Program |
| 4.10.1 | Parser Source Code |
| 4.10.2 | Lexical Analyzer Source Code |
| 5 | Using m4 Macros in Your Programs |
| 5.1 | Using Macros |
| 5.2 | Defining Macros |
| 5.2.1 | Using the Quote Characters |
| 5.2.2 | Macro Arguments |
| 5.3 | Using Other m4 Macros |
| 5.3.1 | Changing the Comment Characters |
| 5.3.2 | Changing the Quote Characters |
| 5.3.3 | Removing a Macro Definition |
| 5.3.4 | Checking for a Defined Macro |
| 5.3.5 | Using Integer Arithmetic |
| 5.3.6 | Manipulating Files |
| 5.3.7 | Redirecting Output |
| 5.3.8 | Using System Programs in a Program |
| 5.3.9 | Using Unique File Names |
| 5.3.10 | Using Conditional Expressions |
| 5.3.11 | Manipulating Strings |
| 5.3.12 | Printing |
| 6 | Revision Control: Managing Source Files with RCS or SCCS |
| 6.1 | Overview of Revision Control |
| 6.2 | Version Control Concepts |
| 6.3 | Managing Multiple Versions of Files |
| 6.4 | Creating a Version Control Library |
| 6.5 | Using RCS |
| 6.5.1 | Placing New Files in an RCS Library |
| 6.5.2 | Recording File-Identification Information with RCS |
| 6.5.3 | Getting Files from an RCS Library |
| 6.5.4 | Checking Edited Files Back into an RCS Library |
| 6.5.5 | Working with Multiple Versions of Files |
| 6.5.6 | Displaying Differences in RCS Files |
| 6.5.7 | Reporting Revision Histories of RCS Files |
| 6.5.8 | Configuration Control Concepts |
| 6.6 | Using SCCS |
| 6.6.1 | Placing New Files in an SCCS Library |
| 6.6.2 | Recording File-Identification Information with SCCS |
| 6.6.3 | Getting Files from an SCCS Library |
| 6.6.3.1 | Getting Files for Purposes Other Than Editing |
| 6.6.3.2 | Getting Files for Editing |
| 6.6.3.3 | Managing Multiple Files and New Releases |
| 6.6.4 | Checking Edited Files Back into an SCCS Library |
| 6.6.5 | Working with Multiple Versions of Files |
| 6.6.6 | Displaying Differences in SCCS Files |
| 6.6.7 | Reporting Revision Histories of SCCS Files |
| 6.6.8 | Performing Administrative Functions |
| 6.6.9 | Using SCCS Options |
| 6.6.10 | Summary of Individual SCCS Commands |
| 6.7 | Functional Comparison of RCS and SCCS Commands |
| 7 | Building Programs with the make Utility |
| 7.1 | Operation of the make Utility |
| 7.2 | Description Files |
| 7.2.1 | Format of a Description File Entry |
| 7.2.2 | Using Commands in a Description File |
| 7.2.3 | Preventing the make Utility from Echoing Commands |
| 7.2.4 | Preventing the make Utility from Stopping on Errors |
| 7.2.5 | Defining Default Conditions |
| 7.2.6 | Preventing make from Deleting Files |
| 7.2.7 | Simple Description File |
| 7.2.8 | Making the Description File Simpler |
| 7.2.9 | Defining Macros |
| 7.2.10 | Using Macros in a Description File |
| 7.2.10.1 | Macro Substitution |
| 7.2.10.2 | Conditional Macros |
| 7.2.11 | Calling the make Utility from a Description File |
| 7.2.12 | Internal Macros |
| 7.2.12.1 | Internal Target File Name Macro |
| 7.2.12.2 | Internal Label Name Macro |
| 7.2.12.3 | Internal Younger Files Macro |
| 7.2.12.4 | Internal First Out-of-Date File Macro |
| 7.2.12.5 | Internal Current File Name Prefix Macro |
| 7.2.13 | How make Uses Environment Variables |
| 7.2.14 | Internal Rules |
| 7.2.14.1 | Single Suffix Rules |
| 7.2.14.2 | Overriding Built-In make Macros |
| 7.2.15 | Including Other Files |
| 7.2.16 | Testing Description Files |
| 7.2.17 | Description File |
| Glossary |
| Examples |
| 4-1 | Parser Source Code for a Calculator |
| 4-2 | Lexical Analyzer Source Code for a Calculator |
| 7-1 | A Simple Description File |
| 7-2 | Default Rules File |
| 7-3 | The makefile for the make Utility |
| Figures |
| 2-1 | Sequence of awk Processing |
| 3-1 | Sequence of sed Processing |
| 4-1 | Simple Finite State Model |
| 4-2 | Producing an Input Parser with lex and yacc |
| 6-1 | Contents of a Version Control File |
| 6-2 | A Typical RCS Library |
| 6-3 | A Typical SCCS Library |
| 6-4 | A Version Control File's Tree of Deltas |
| Tables |
| 1-1 | Rules for Basic Regular Expressions |
| 1-2 | Rules for Extended Regular Expressions |
| 1-3 | Behavior of the grep Command |
| 1-4 | Flags for the grep Command |
| 2-1 | Flags for the awk Command |
| 2-2 | Built-In Variables in awk |
| 2-3 | Operators for awk Actions |
| 2-4 | Built-In awk Mathematical Functions |
| 2-5 | Built-In awk String Functions |
| 2-6 | Built-In awk Miscellaneous Functions |
| 2-7 | Control Structures in awk |
| 3-1 | Flags for the sed Command |
| 3-2 | Special Regular Expressions Recognized by sed |
| 3-3 | Text Editing and Movement Commands |
| 3-4 | Buffer Manipulation Commands |
| 3-5 | Flow-of-Control Commands |
| 4-1 | Regular Expression Operators for lex |
| 4-2 | Options for the lex Command |
| 4-3 | Processing-Condition Definition Keywords in yacc |
| 5-1 | Built-In m4 Macros |
| 6-1 | Features of RCS and SCCS |
| 6-2 | Summary of RCS Command Functions |
| 6-3 | RCS ID Keywords |
| 6-4 | Summary of sccs Command Functions |
| 6-5 | SCCS ID Keywords |
| 6-6 | SCCS admin Command Options |
| 6-7 | Flags for the admin Command |
| 6-8 | SCCS Command Options |
| 6-9 | Individual SCCS Commands |
| 6-10 | Functional Comparison: RCS and SCCS Commands |
| 7-1 | Internal make Macros |
| Index |