As always, you need to choose the right tool for the right job, and that means knowing what the tools can and can't do.
is an advanced text processing
language. If you do a lot of work extracting, editing, and reformatting text data from files or commands, then it will pay to learn how to use it. If, for example, you find yourself often chaining together strings of cut
, then they can generally be replaced with a single awk
command. Stand-alone awk
scripts can also often be used instead of combined shell+command scripts for text processing jobs (and will generally be more efficient in such cases).
But what awk isn't
, is a general scripting tool. It won't replace the shell for things like file renaming or system maintenance. Although it does have a built-in ability to execute external commands, it's really more of a support feature for the main task of text processing, and isn't designed for general use.
So by all means do learn how to use awk
. But don't think you need to dive deeply into it all at once. I suggest first taking enough time to learn what
it can do, without worrying much about learning how
to do it. Then you can decide how much time to put into studying it in detail. But in the end it's just another system tool, and the more familiar you are with it the more you'll be able to do with it.
Here are a few useful awk references:
The first one is probably the best for getting an overall view of the command.
BTW, another benefit of studying things like this is that the concepts you learn in one language very often translate over and help you in learning others as well. Much of awk
syntax comes from C
, which has also influenced many other languages and commands. I believe that learning awk
has also improved my scripting ability in general.