Название: The AWK Programming Language, 2nd Edition (Final)
Автор: Alfred V. Aho, Brian W. Kernighan, Peter J. Weinberger
Издательство: Addison-Wesley/Pearson
Год: 2024
Страниц: 231
Язык: английский
Формат: True PDF, True EPUB (Retail Copy)
Размер: 17.0 MB
The goal of this book is to teach you what AWK is and how to use it effectively. AWK is a programming language that makes it possible to handle simple computations with short programs, often only one or two lines long. An AWK program is a sequence of patterns and actions that specify what to look for in the input data and what to do when it’s found. Awk searches a set of files that contain text (but not non-text formats like Word documents, spreadsheets, PDFs and so on) for lines that match 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 arbitrary processing on selected lines; the action language looks like C but there are no declarations, and strings and numbers are built-in data types. Programmers and other computer users spend a lot of time doing simple, mechanical data manipulation — changing the format of data, checking its validity, finding items that have some property, adding up numbers, printing summaries, 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 language like C or Python each time such a task comes up.