Linked by pkrumins on Thu 19th Feb 2009 12:17 UTC
General Development If you have ever been interested in awk and sed Unix utilities, then you probably know about the awk1line.txt and sed1line.txt files that are floating around the Internet. Each file contains around 80 idiomatic sed and awk one-liners for performing various text modification tasks.
Thread beginning with comment 349799
To view parent comment, click here.
To read all comments associated with this story, please click here.
Kroc
Member since:
2005-11-10

Depends on the load you have to lift. If I wanted to perform a quick bucket-sort, then I’d use PHP, VBScript or any other non-compact scripting language. But if I had to make a syntax processor (like I have: http://camendesign.com/code/remarkable ), then there’s no way I’d do it without regex. I’d have to practically reimplement a hard-coded regex engine in the process of handling the byte-by-byte matching for all the use-cases.

Sure the likes of sed and awk are hard to use, but there’s wizards out there who can, and those of us who can’t -- it’s not ours to say that one tool is better than the other, when in the right hands.

Reminds me of this T-Shirt - http://www.thinkgeek.com/tshirts-apparel/unisex/frustrations/374d/?... - "Go away or I will replace you with a very small shell script."

Edited 2009-02-19 13:08 UTC

Reply Parent Score: 1

massysett Member since:
2007-12-04

I've never considered awk hard to use. You can learn the basics in about thirty pages. Have you ever sat down and read "Effective GAWK Programming"?

http://www.gnu.org/software/gawk/manual/gawk.html

sed is not hard either. Python is great too, but for little quick jobs awk is great. awk can be just as maintainable if you write it cleanly (and I've seen python code that is a mess, because you can write messy Python too.) But for a one liner, who cares if it is maintainable? You use it once then throw it out!

Reply Parent Score: 3

AtariFan Member since:
2009-01-15

This manual has 360 pages (pdf-version). I would like to learn the basics of awk and has already bought a German cheap reference by O'Reilly.
Do you know a shorter tutorial?

Reply Parent Score: 1