Effective AWK Programming: A User's Guide for GNU Awk, Edition 1.0.3

Overview

Effective AWK Programming teaches you about the awk language and how you can use it effectively. You should already be familiar with basic system commands, such as cat and ls, (1) and basic shell facilities, such as Input/Output (I/O) redirection and pipes.

Implementations of the awk language are available for many different computing environments. Effective AWK Programming, while describing the awk language in general, also describes a particular implementation of awk called ...

See more details below
This Paperback is Not Available through BN.com
Sending request ...

Overview

Effective AWK Programming teaches you about the awk language and how you can use it effectively. You should already be familiar with basic system commands, such as cat and ls, (1) and basic shell facilities, such as Input/Output (I/O) redirection and pipes.

Implementations of the awk language are available for many different computing environments. Effective AWK Programming, while describing the awk language in general, also describes a particular implementation of awk called gawk (which stands for "GNU Awk"). gawk runs on a broad range of Unix systems, ranging from 80386 PC-based computers, up through large scale systems, such as Crays. Gawk has also been ported to MS-DOS and OS/2 PC's, Atari and Amiga micro-computers, and VMS.

iUniverse.com computer books are composed of freely available online computer manuals, industry standard specifications, and electronically distributed computer programming guides. They include open documents collections of industry specifications and standards and a collection of the best open source documentation on the Web...the most complete open source library available anywhere.

Each book contains the complete, unabridged text of the original document. Our on-demand publishing process gives you the actual text of the online document in a convenient, inexpensive, easy-to-use format.

And remember...iUniverse.com donates a portion of the profits from open document and open source books to support the mission of the free software community.

Read More Show Less

Product Details

  • ISBN-13: 9780595100347
  • Publisher: iUniverse, Incorporated
  • Publication date: 8/28/2000
  • Pages: 393
  • Product dimensions: 7.57 (w) x 9.34 (h) x 0.92 (d)

Table of Contents

GNU General Public License xix
Preamble xix
Terms and Conditions for Copying, Distribution and Modification xx
End of Terms and Conditions xxv
How to Apply These Terms to Your New Programs xxv
History of awk and gawk xxvii
The GNU Project and This Book xxviii
Acknowledgements xxix
Using This Book xxxiv
Typographical Conventions xxxv
Data Files for the Examples xxxvi
Chapter 1 Getting Started with awk 1
A Rose By Any Other Name 1
How to Run awk Programs 2
A Very Simple Example 6
An Example with Two Rules 7
A More Complex Example 8
awk Statements Versus Lines 10
Other Features of AWKp11
When to Use AWK 12
Chapter 2 Useful One Line Programs 14
Chapter 3 Regular Expressions 16
How to Use Regular Expressions 16
Escape Sequences 18
Regular Expression Operators 21
Additional Regexp Operators Only in gawk 28
Case-sensitivity in Matching 30
How Much Text Matches? 32
Using Dynamic Regexps 32
Chapter 4 Reading Input Files 34
How Input is Split into Records 34
Examining Fields 37
Non-constant Field Numbers 39
Changing the Contents of a Field 40
Specifying How Fields are Separated 42
Reading Fixed-width Data 48
Multiple-Line Records 50
Explicit Input with getline 53
Chapter 5 Printing Output 61
The print Statement 61
Examples of print Statements 62
Output Separators 63
Controlling Numeric Output with print 64
Using printf Statements for Fancier Printing 65
Redirecting Output of print and printf 72
Special File Names in gawk 74
Closing Input and Output Files and Pipes 77
Chapter 6 Expressions 80
Constant Expressions 80
Using Regular Expression Constants 81
Variables 83
Conversion of Strings and Numbers 85
Arithmetic Operators 86
String Concatenation 88
Assignment Expressions 89
Increment and Decrement Operators 93
True and False in AWK 94
Variable Typing and Comparison Expressions 95
Boolean Expressions 99
Conditional Expressions 101
Function Calls 102
Operator Precedence (How Operators Nest) 103
Chapter 7 Patterns and Actions 106
Pattern Elements 106
Overview of Actions 113
Chapter 8 Control Statements in Actions 115
The if-else Statement 115
The while Statement 116
The do-while Statement 117
The for Statement 118
The break Statement 120
The continue Statement 121
The next Statement 122
The next file Statement 123
The exit Statement 124
Chapter 9 Built-in Variables 126
Built-in Variables that Control AWK 126
Built-in Variables that Convey Information 128
Using ARGC and ARGV 131
Chapter 10 Arrays in AWK 134
Introduction to Arrays 134
Referring to an Array Element 136
Assigning Array Elements 137
Basic Array Example 137
Scanning All Elements of an Array 138
The delete Statement 140
Using Numbers to Subscript Arrays 141
Using Uninitialized Variables as Subscripts 142
Multi-dimensional Arrays 143
Scanning Multi-dimensional Arrays 145
Chapter 11 Built-in Functions 147
Calling Built-in Functions 147
Numeric Built-in Functions 148
Built-in Functions for String Manipulation 150
Built-in Functions for Input/Output 157
Functions for Dealing with Time Stamps 160
Chapter 12 User-defined Functions 168
Function Definition Syntax 168
Function Definition Examples 170
Calling User-defined Functions 172
The return Statement 174
Chapter 13 Running AWK 176
Command Line Options 176
Other Command Line Arguments 181
The AWKAPTH Environment Variable 183
Obsolete Options and/or Features 184
Undocumented Options and Features 184
Known Bugs in GAWK 184
Chapter 14 A Library of awk Functions 185
Simulating gawk-specific Features 185
Implementing next file as a Function 186
Assertions 188
Rounding Numbers 190
Translating Between Characters and Numbers 191
Merging an Array Into a String 193
Turning Dates Into Timestamps 194
Managing the Time of Day 200
Noting Data File Boundaries 202
Processing Command Line Options 204
Reading the User Database 210
Reading the Group Database 215
Naming Library Function Global Variables 221
Chapter 15 Practical AWK Programs 223
Re-inventing Wheels for Fun and Profit 223
A Grab Bag of awk Programs 249
Chapter 16 The Evolution of the AWK Language 275
Major Changes between V7 and SVR3.1 275
Changes between SVR3.1 and SVR4 277
Changes between SVR4 and POSIX AWK 278
Extensions in the Bell Laboratories awk 279
Extensions in gawk Not in POSIX AWK 279
Chapter 17 gawk Summary 283
Command Line Options Summary 283
Language Summary 286
Variables and Fields 287
Patterns 292
Actions 298
User-defined Functions 312
Historical Features 313
Chapter 18 Installing GAWK 315
The GAWK Distribution 315
Compiling and Installing GAWK on Unix 324
How to Compile and Install GAWK on VMS 326
MS-DOS and OS/2 Installation and Compilation 329
Installing gawk on the Atari ST 330
Installing gawk on an Amiga 332
Reporting Problems and Bugs 333
Other Freely Available awk Implementations 335
Chapter 19 Implementation Notes 337
Downward Compatibility and Debugging 337
Making Additions to GAWK 337
Probable Future Extensions 342
Suggestions for Improvements 343
Chapter 20 Glossary 345
Footnotes 357
GNU Free Documentation License 363
Table of Contents 363
GNU Free Documentation License 363
How to use this License for your documents 371
The GNU Project 373
The first software-sharing community 373
The collapse of the community 374
A stark moral choice 375
Free as in freedom 377
GNU software and the GNU system 378
Commencing the project 378
The first steps 378
GNU Emacs 379
Is a program free for every user? 380
Copyleft and the GNU GPL 380
The Free Software Foundation 381
Free software support 382
Technical goals 383
The GNU Task List 384
The GNU Library GPL 384
Scratching an itch? 385
Unexpected developments 386
The GNU Hurd 386
Alix 387
Linux and GNU/Linux 387
Challenges in our future 388
Secret hardware 388
Non-free libraries 388
Software patents 390
Free documentation 390
We must talk about freedom 391
"Open Source" 392
Try! 393
Read More Show Less

Customer Reviews

Be the first to write a review
( 0 )
Rating Distribution

5 Star

(0)

4 Star

(0)

3 Star

(0)

2 Star

(0)

1 Star

(0)

Your Rating:

Your Name: Create a Pen Name or

Barnes & Noble.com Review Rules

Our reader reviews allow you to share your comments on titles you liked, or didn't, with others. By submitting an online review, you are representing to Barnes & Noble.com that all information contained in your review is original and accurate in all respects, and that the submission of such content by you and the posting of such content by Barnes & Noble.com does not and will not violate the rights of any third party. Please follow the rules below to help ensure that your review can be posted.

Reviews by Our Customers Under the Age of 13

We highly value and respect everyone's opinion concerning the titles we offer. However, we cannot allow persons under the age of 13 to have accounts at BN.com or to post customer reviews. Please see our Terms of Use for more details.

What to exclude from your review:

Please do not write about reviews, commentary, or information posted on the product page. If you see any errors in the information on the product page, please send us an email.

Reviews should not contain any of the following:

  • - HTML tags, profanity, obscenities, vulgarities, or comments that defame anyone
  • - Time-sensitive information such as tour dates, signings, lectures, etc.
  • - Single-word reviews. Other people will read your review to discover why you liked or didn't like the title. Be descriptive.
  • - Comments focusing on the author or that may ruin the ending for others
  • - Phone numbers, addresses, URLs
  • - Pricing and availability information or alternative ordering information
  • - Advertisements or commercial solicitation

Reminder:

  • - By submitting a review, you grant to Barnes & Noble.com and its sublicensees the royalty-free, perpetual, irrevocable right and license to use the review in accordance with the Barnes & Noble.com Terms of Use.
  • - Barnes & Noble.com reserves the right not to post any review -- particularly those that do not follow the terms and conditions of these Rules. Barnes & Noble.com also reserves the right to remove any review at any time without notice.
  • - See Terms of Use for other conditions and disclaimers.
Search for Products You'd Like to Recommend

Recommend other products that relate to your review. Just search for them below and share!

Create a Pen Name

Your Pen Name is your unique identity on BN.com. It will appear on the reviews you write and other website activities. Your Pen Name cannot be edited, changed or deleted once submitted.

 
Your Pen Name can be any combination of alphanumeric characters (plus - and _), and must be at least two characters long.

Continue Anonymously

    If you find inappropriate content, please report it to Barnes & Noble
    Why is this product inappropriate?
    Comments (optional)