Limitations
There are fixed limits within any awk implementation. The only trouble is that the documentation seldom reports them. Table 10.1 lists the limitations as described in The AWK Programming Language. These limitations are implementation-specific but they are good ballpark figures for most systems.
Item | Limit |
Number of fields per record | 100 |
Characters per input record | 3000 |
Characters per output record | 3000 |
Characters per field | 1024 |
Characters per printf string | 3000 |
Characters in literal string | 400 |
Characters in character class | 400 |
Files open | 15 |
Pipes open | 1 |
Note
Despite the number in Table 10.1, experience has shown that most awks allow you to have more than one open pipe.
In terms of numeric values, awk uses double-precision, floating-point numbers that are limited in size by the machine’s architecture.
Running into these limits can cause unanticipated problems with scripts. In developing examples for the first edition of this book, Dale thought he’d write a search program that could look for a word or sequence of words in a single paragraph. The idea was to read a document as a series of multiline records and if any of the fields contained the search term, print the record, which was a paragraph. It could be used to search through mail files where blank lines delimit paragraphs. The resulting program worked for small test files. However, when tried on larger files, the program dumped core because it encountered a paragraph that was longer than the maximum input record ...
Get sed & awk, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.