4 ms·
AWK is worth learning completely. It hits a real sweet spot in terms of minimizing the number of lines of code needed to write useful programs in the world of q
by minimax 13y ago
AWK is worth learning completely. It hits a real sweet spot in terms of minimizing the number of lines of code needed to write useful programs in the world of quasi-structured (not quite CSV but not completely free form) data. You can learn the whole language and become proficient in an afternoon.
I recommend "The AWK Programming Language" by Aho, Kernighan, and Weinberger, though it seems to be listed for a hilariously high price on Amazon at the moment. Maybe try to pick up a used copy.
- daemon13 13y agoI recall there was a pointer to an old great AWK tutorial some time ago - smth along the lines 'how to approach awk language....' - anyone kept the link?
- foobarbazqux 13y agoThis is the first hit for awk tutorial and it's all you need. http://www.grymoire.com/Unix/Awk.html http://www.grymoire.com/Unix/Awk.html
- McUsr 13y agoI think Steve's Awk academy is a nice supplement to Grymoire : http://www.troubleshooters.com/codecorn/awk/ http://www.troubleshooters.com/codecorn/awk/ By the way: what people need to understand is that in order to use Awk, efficently, you'll either use associative arrays, or structure your script like a sed script, otherwise it will be slow. The interesting thing about both of those, is the regex algorithm Thompson NFA, that is from what I hear around 7 times faster than PCRE that is used in Perl, PHP, Python and Ruby?
- jnazario 13y agoi wrote one a long time ago: http://linuxgazette.net/67/nazario.html http://linuxgazette.net/67/nazario.html i still use a buttload of awk for data science type uses.
- kingmanaz 13y ago>I recommend "The AWK Programming Language" by Aho, Kernighan, and Weinberger I concur with this recommendation. "The AWK Programming Language", at little over 100 pages, is a classic of programming language instruction. The book jumps right into use cases, it does not waste one's time. This book should be required reading for anyone contemplating writing a handbook on any programming language; my CS bookshelf would be several feet thinner and several times more informative.
- cjg_ 13y agoSadly it seems very expensive now, $95 on Amazon...
- KC8ZKF 13y agoUSD 8.99 used, with 3.99 shipping.
- jh3 13y agoFortunately, a google search for "the awk programming language pdf" returns a link to this: http://books.cat-v.org/computer-science/awk-programming-language/The_AWK_Programming_Language.pdf http://books.cat-v.org/computer-science/awk-programming-lang... It's the first result for me.
- EvanKelly 13y agoHere is Kernighan's personal help file on AWK: http://www.cs.princeton.edu/courses/archive/spr08/cos333/awk.help http://www.cs.princeton.edu/courses/archive/spr08/cos333/awk... It deals with things he forgets or needs to remind himself of. If you're interested in his other personal tutorials, they are here: http://www.cs.princeton.edu/courses/archive/spr08/cos333/tutorials.html http://www.cs.princeton.edu/courses/archive/spr08/cos333/tut...
- username42 13y agoKernighan's personal help file is excellent. If you need more, you should switch to a more powerful language.
- username42 13y agoI advise not learning more than basic usage of awk and to spend the time on more versatile languages. You can do very neat tricks with sed and awk, but when the problems become more complex, it is a lot faster to use a smarter language. And if you know well this language, you will discover that it may also be very concise for relatively simpler tasks. When Perl was created, one of its advertised goal was to avoid all the time lost trying to work around the limitations of awk, sed and shell.