(In addition to
sko-s remarks.)
That's is likely a misconception. It may appear so, because, just as in sed, awk might be used, especially on the command line, highly decorated with regular expressions. That is
one of its strength's.
Both
sed(1) &
awk(1) use:
- regular expressions
- automatic processing on a line-per-line basis
For
sed(1) #1 and #2 are its main strengths. Then there is sed's brevity; that translates for most (myself included) to cryptic coding and reading when not practiced often enough . There isn't much more: its limited. It is, after all, a
streaming editor.
For
awk(1) #1 is just one of its strong points. It can easily, and effectively, be used on the command line. There,
awk(1) shows that it is a balanced command-line-scripting language; in my view without contest.
awk(1) is far less cryptic than
sed(1). Don't forget that (extended) regular expression are cryptic,
by nature; in any language!
However, besides #1 and #2,
awk(1) has more to offer. If you can forego the use of libraries, such as used by Python, it is a very well balanced programming language, devoid of any excess features. You need more in
awk(1)? make use of all the standard UNIX utilities outside, either by means of pre- or post-processing, or by calling them from within
awk(1). There are no extended data structures, but associative arrays are very versatile. Not the fastest, but, in general, if you need more speed, you should be thinking about optmizing the complete scripting pipeline with externally sourced functionalities. Then, it may also be time to consider switching to another programming language alltogteher.
Perhaps #2 feels as a burden, however, one does not
need to use its automatic line-by-line processing, also: not all of the time. You can do all your programming without it; use
BEGIN {<your program>}
. Of course when you make more extended use of
awk(1), you probably have left the command line and are using a script file. In my view, Brian Kernighan, as a co-author of
the 'C book' (he also co-authored a
Go book) is one of the best writers when it comes to a clear and consise exposition of programming in general or a programming language in particular. If you're at all interested what's on offer, I suggest you have a look at
bwk's home page and the second edition of the awk book. However, just for starters, I've found
Awk by Bruce Barnett, invaluable to have at a 'screens reach'.