Cover image for sed and awk Pocket Reference, 2nd Edition

Book description

For people who create and modify text files, sed and awk are powertools for editing. sed, awk, and regular expressions allowprogrammers and system administrators to automate editing tasksthat need to be performed on one or more files, to simplify thetask of performing the same edits on multiple files, and to writeconversion programs. The sed & awk Pocket Reference is acompanion volume to sed & awk, Second Edition, Unix in aNutshell, Third Edition, and Effective awk Programming,Third Edition. This new edition has expanded coverage of gawk(GNU awk), and includes sections on:

  • An overview of sed and awk?s command linesyntax

  • Alphabetical summaries of commands, including nawkand gawk

  • Profiling with pgawk

  • Coprocesses and sockets with gawk

  • Internationalization with gawk

  • A listing of resources for sed and awk users

This small book is a handy reference guide to the informationpresented in the larger volumes. It presents a concise summary ofregular expressions and pattern matching, and summaries of sed andawk. Arnold Robbins, an Atlanta native now happily living inIsrael, is a professional programmer and technical author andcoauthor of various O'Reilly Unix titles. He has been working withUnix systems since 1980, and currently maintains gawk and itsdocumentation.

Table of Contents

  1. sed & awk Pocket Reference
  2. 1. sed & awk Pocket Reference
    1. 1.1. Introduction
    2. 1.2. Conventions Used in This Book
    3. 1.3. Matching Text
      1. 1.3.1. Filenames Versus Patterns
      2. 1.3.2. Metacharacters
        1. 1.3.2.1. Search patterns
        2. 1.3.2.2. Replacement patterns
      3. 1.3.3. Metacharacters, Listed by Unix Program
      4. 1.3.4. Examples of Searching
        1. 1.3.4.1. Examples of searching and replacing
    4. 1.4. The sed Editor
      1. 1.4.1. Command-Line Syntax
      2. 1.4.2. Syntax of sed Commands
        1. 1.4.2.1. Pattern addressing
        2. 1.4.2.2. Examples
      3. 1.4.3. Group Summary of sed Commands
        1. 1.4.3.1. Basic editing
        2. 1.4.3.2. Line information
        3. 1.4.3.3. Input/output processing
        4. 1.4.3.4. Yanking and putting
        5. 1.4.3.5. Branching commands
        6. 1.4.3.6. Multiline input processing
      4. 1.4.4. Alphabetical Summary of sed Commands
    5. 1.5. The awk Programming Language
      1. 1.5.1. Command-Line Syntax
      2. 1.5.2. Important gawk Options
      3. 1.5.3. Profiling with pgawk
      4. 1.5.4. Patterns and Procedures
        1. 1.5.4.1. Patterns
        2. 1.5.4.2. Procedures
        3. 1.5.4.3. Simple pattern-procedure examples
      5. 1.5.5. Built-in Variables
      6. 1.5.6. Operators
      7. 1.5.7. Variable and Array Assignment
        1. 1.5.7.1. Escape sequences
      8. 1.5.8. Octal and Hexadecimal Constants in gawk
      9. 1.5.9. User -Defined Functions
      10. 1.5.10. Group Listing of awk Functions and Commands
      11. 1.5.11. Coprocesses and Sockets with gawk
      12. 1.5.12. Implementation Limits
      13. 1.5.13. Alphabetical Summary of awk Functions and Commands
        1. 1.5.13.1. Output redirections
        2. 1.5.13.2. printf formats
      14. 1.5.14. Internationalization with gawk
    6. 1.6. Additional Resources
      1. 1.6.1. Source Code
      2. 1.6.2. Books
  3. About the Author
  4. Copyright