Наши партнеры

Книги по Linux (с отзывами читателей)

Библиотека сайта rus-linux.net

6.4. Summary

The gawk utility interprets a special-purpose programming language, handling simple data-reformatting jobs with just a few lines of code. It is the free version of the general UNIX awk command.

This tools reads lines of input data and can easily recognize columned output. The print program is the most common for filtering and formatting defined fields.

On-the-fly variable declaration is straightforward and allows for simple calculation of sums, statistics and other operations on the processed input stream. Variables and commands can be put in awk scripts for background processing.

Other things you should know about awk:

  • The language remains well-known on UNIX and alikes, but for executing similar tasks, Perl is now more commonly used. However, awk has a much steeper learning curve (meaning that you learn a lot in a very short time). In other words, Perl is more difficult to learn.

  • Both Perl and awk share the reputation of being incomprehensible, even to the actual authors of the programs that use these languages. So document your code!