The AWK Programming Language

by ; ;
Edition: 1st
Format: Paperback
Pub. Date: 2019-04-25
Publisher(s): Pearson
  • Free Shipping Icon

    Free Shipping On All Orders!*

    Free economy shipping applies to all orders shipped to residential addresses. Orders shipped to campus receive free standard shipping. Free shipping offers do not apply to Marketplace items.

List Price: $153.32

Rent Textbook

Select for Price
There was a problem. Please try again later.

New Textbook

We're Sorry
Sold Out

Used Textbook

We're Sorry
Sold Out

eTextbook

We're Sorry
Not Available

How Marketplace Works:

  • This item is offered by an independent seller and not shipped from our warehouse
  • Item details like edition and cover design may differ from our description; see seller's comments before ordering.
  • Sellers much confirm and ship within two business days; otherwise, the order will be cancelled and refunded.
  • Marketplace purchases cannot be returned to eCampus.com. Contact the seller directly for inquiries; if no response within two days, contact customer service.
  • Additional shipping costs apply to Marketplace purchases. Review shipping costs at checkout.

Summary

Originally developed by Alfred Aho, Brian Kernighan, and Peter Weinberger in 1977, AWK is a pattern-matching language for writing short programs to perform common data-manipulation tasks.

Author Biography

Brian W. Kernighan works in the Computing Science Research Center at Bell Laboratories, Lucent Technologies. He is Consulting Editor for Addison-Wesley's Professional Computing Series and the author, with Dennis Ritchie, of The C Programming Language.

020107981XAB04062001

Table of Contents

Preface.
1. An AWK Tutorial.
Getting Started.
Simple Output.
Fancier Output.
Selection.
Computing with AWK.
Control-Flow Statements.
Arrays.
A Handful of Useful “One-liners.”
What Next?

2. The AWK Lanaguage.
Patterns.
Actions.
User-Defined Functions.
Output.
Input.
Interaction with Other Programs.
Summary.

3. Data Processing.
Data Transformation and Reduction.
Data Validation.
Bundle and Unbundle.
Multiline Records.
Summary.

4. Reports and Databases.
Generating Reports.
Packaged Queries.
A Relational Database System.
Summary.

5. Processing Words.
Random Text Generation.
Interactive Text-Manipulation.
Text Processing.
Summary.

6. Little Languages.
An Assembler and Interpreter.
A Language for Drawing Graphs.
A Sort Generator.
A Reverse-Polish Calculator.
An Infix Calculator.
Recursive-Descent Parsing.
Summary.

7. Experiments with Algorithms.
Sorting.
Profiling.
Topological Sorting.
Make: A File Updating Program.
Summary.

8. Epilog.
AWK as a Language.
Performance.
Conclusion.

Appendix A: AWK Summary.
Appendix B: Answers to Selected Exercises.
Index.

Excerpts

Computer users spend a lot of time doing simple mechanical data manipulation -- changing the format of data, checking its validity, finding items with some property, adding up numbers, printing reports, and the like. All of these jobs ought to be mechanized, but it's a real nuisance to have to write a special-purpose program in a standard language like C or Pascal each time such a task comes up.Awk is a programming language that makes it possible to handle such tasks with very short programs, often only one or two lines long. An awk program is a sequence of patterns and actions that tell what to look for in the input data and what to do when it's found. Awk searches a set of files for lines matched by any of the patterns; when a matching line is found, the corresponding action is performed. A pattern can select lines by combinations of regular expressions and comparison operations on strings, numbers, fields, variables, and array elements. Actions may perform arbutrary processing on selected lines,; the action language looks like C but there are no declarations, and strings and numbers are built-in data types.Awk scans the input files and splits each input line into fields automatically. Because so many things are automatic--input, field splitting, storage management, initialization--awk programs are usually much smaller than they would be in a more conventional language. Thus one common use of awk is for the kind of data manipulation suggested above. Programs, a line or two long, are composed at the keyboard, run once, then discarded. In effect, awk is a general-purpose programable tool that can replace a host of specialized tools or programs.The same brevity of expression and convenience of operations make awk valuable for prototyping larger programs. One starts with a few lines, then refines the program unitil it doesth edesired job, experimenting with designs by trying alternatives quickly. Since programs are short, it's easy to get started, and easy to start over when experience suggests a different direction. And, it's straightforward to translate an awk program into another language once the design is right. Organization of the BookThe first goal of this book is to teach you what awk is and how to use it effectively. Chapter 1 is a tutorial on the bare minimum necessary to get started; after reading even a few pages you should have enough information to begin writing useful programs. The examples in this chapter are very short and simple, typical othe interactive use of awk.Chapter 2 covers the entire language in a systematic order. Although there are plenty of examples in this chapter, like most manuals it's long and a bit dry, so you will probably want to skim it on a first reading.The rest of the book contains a wide variety of examples, chosen to show the breadth of applicability of awk and how to make good use of its facilities. Some of the programs are in regular use in our environment; others show ideas but are not intended for production use; a few are included just because they are fun.The emphasis in Chapter 3 is on retrieval, transformation, reduction and validation of data--the tasks that awk was originally designed for. There is also a discussion of how to handle data like address lists that naturally comes in multiline chunks.Awk is a good language for managing small, personal databases. Chapter 4 discusses the generation of reports from databases, and builds a simple relational database system and query language for data stored in multiple files.Awk handles text with much the same convenience that most languages handle numbers, so it often finds application in text processing. Chapter 5 describes programs for generating text, and some that help with document preparation. One of the examples is an indexing program based on the one we used for this book.Chapter

An electronic version of this book is available through VitalSource.

This book is viewable on PC, Mac, iPhone, iPad, iPod Touch, and most smartphones.

By purchasing, you will be able to view this book online, as well as download it, for the chosen number of days.

Digital License

You are licensing a digital product for a set duration. Durations are set forth in the product description, with "Lifetime" typically meaning five (5) years of online access and permanent download to a supported device. All licenses are non-transferable.

More details can be found here.

A downloadable version of this book is available through the eCampus Reader or compatible Adobe readers.

Applications are available on iOS, Android, PC, Mac, and Windows Mobile platforms.

Please view the compatibility matrix prior to purchase.