Cover image for Unix awk and sed programmer's interactive workbook
Unix awk and sed programmer's interactive workbook
Patsis, Peter.
Personal Author:
Publication Information:
Upper Saddle River, N.J. : Prentice Hall PTR, [1999]

Physical Description:
xix, 622 pages : illustrations ; 24 cm.
General Note:
Includes index.
Format :


Call Number
Material Type
Home Location
Item Holds
QA76.76.O63 P3778 1999 Adult Non-Fiction Central Closed Stacks

On Order



Start with a hands-on introduction to regular expressions and grep-including egrep and fast grep. Learn key sed fundamentals: addressing, scripting, plus all the commands youll need for substitution, deletion, printing, appending, listing, reading/writing, and more. Walk step-by-step through awk, writing simple programs, understanding data types, statements, expressions, patterns, actions, functions, control flow, arrays, and I/O-all you need to solve real-world problems Master awk and sed programming now Totally integrated with a FREE, state-of-the-art UNIX learning Web site Every UNIX Interactive Workbook is fully integrated with its own exclusive Web site, giving you all this and more: 'Test Your Thinking' project solutions and detailed explanations Authors Corner: Your personal connection to this books expert author Practice questions with instant feedback and explanations An exclusive message board where you can interact with other students Just the facts No endless, boring discussions here Youll learn hands-on, through practical exercises, self-review questions and real-world answers. Exclusive 'Test Your Thinking' projects guarantee youll go beyond rote knowledge to

Author Notes

Peter Patsis is a systems engineer at Digital Equipment Corporation. He resides in Shrewsbury, MA.

Table of Contents

Forewordp. xiii
Introductionp. xv
About the Authorp. xix
Chapter 1 Regular Expressions and Metacharactersp. 1
Lab 1.1 Using the period and backslash metacharactersp. 2
Chapter 2 Character Class, Hyphen, and Caret Metacharactersp. 27
Lab 2.1 The Character Class, Hyphen, and Caret Metacharactersp. 28
Chapter 3 What Is Grep and What Does It Do?p. 51
Lab 3.1 Getting Started with Grepp. 52
Chapter 4 Using Grep with Regular Expressionsp. 67
Lab 4.1 Regular Expressions and Grepp. 68
Lab 4.2 fgrep and egrepp. 79
Lab 4.3. Using the Anchor Metacharacterp. 85
Chapter 5 Introduction to sedp. 93
Lab 5.1 Getting Started with sedp. 94
Chapter 6 Sed Syntax and Addressingp. 109
Lab 6.1 Sed Syntax and Addressingp. 110
Chapter 7 Sed Commandsp. 135
Lab 7.1 The Substitution Commandp. 136
Lab 7.2 The Delete Commandp. 157
Lab 7.3 The Append, Insert, and Change Commandsp. 164
Lab 7.4 The List and Transform Commandsp. 180
Lab 7.5 The Print and Next Commandsp. 190
Lab 7.6 The Read and Write Commandsp. 201
Chapter 8 Multiline Pattern Space Commandsp. 213
Lab 8.1 The Multiline Next, Delete, and Print Commandsp. 214
Chapter 9 An Awk Programp. 245
Lab 9.1 An Example Awk Programp. 246
Lab 9.2 The Structure of an Awk Programp. 256
Lab 9.3 Invoking an Awk Programp. 265
Chapter 10 Basic Awk Language Elementsp. 273
Lab 10.1 Awk Statements and Expressionsp. 274
Lab 10.2 Awk Stringsp. 282
Lab 10.3 Awk Numbersp. 294
Lab 10.4 Coercionp. 303
Lab 10.5 awk Assignment operatorp. 322
Chapter 11 Variablesp. 331
Lab 11.1 Field Variablesp. 332
Lab 11.2 User-Defined Variablesp. 345
Lab 11.3 Built-In Variablesp. 354
Chapter 12 Operatorsp. 371
Lab 12.1 Arithmetic Operatorsp. 372
Lab 12.2 the Assignment Statementp. 382
Lab 12.3 Logical and Relational Operators, and Conditional Expressionsp. 400
Chapter 13 Built-in Functions, Precedence, Associativity, and Machine Limitsp. 417
Lab 13.1 Built-In Arithmetic Functionsp. 418
Lab 13.2 Built-In String Functionsp. 424
Lab 13.3 Patterns, Precedence, Associativity, and Machine Limitsp. 437
Chapter 14 Awk Control Flowp. 447
Lab 14.1 The If-Else Statementp. 448
Lab 14.2 The While and Do Statementsp. 461
Lab 14.3 The For Statementp. 472
Lab 14.4 Loop and Program Controlp. 480
Chapter 15 Awk Arrays and Functionsp. 493
Lab 15.1 Awk Arraysp. 494
Lab 15.2 Awk User-Defined Functionsp. 516
Chapter 16 Advanced Input and Outputp. 545
Lab 16.1 The printf and sprintf Statementsp. 546
Lab 16.2 Output into Pipes, Files, and the Getline Functionp. 562
Appendix A Answers to Self-Review Questionsp. 577
Appendix B Awk, Sed, and Grep Referencep. 589
Indexp. 617