PDA

View Full Version : Do Regexes scare you? How about sed and awk?



KC2UGV
05-02-2013, 08:04 AM
They used to scare me. I looked at them, and saw a jumble of characters that meant nothing, and reminded me of the programming Language "BrainFuck". Then, I was gifted a copy of the NCR Tower OS manual. The "manual" consists of emails from people like K&R explaining something, and little documents written by people like Alfred Aho, or Pete Weinberger too.

But, back to the point: Regexes were made for a command called "sed". And, the best introduction I've ever read for regexes was a tutorial for sed called,"SED - A Non-Interactive Text Editor". Overnight, people at work started calling me the regex master, the SED Jedi, etc etc.

It's available here: http://www.eecs.berkeley.edu/~clancy/sp.unix.stuff/sed.pdf

If AWK scares you, or you only know very simple ways of employing it, here's a similarly done article on AWK: "Awk - A Pattern Scanning and Processing Language". You can find it here: http://inst.eecs.berkeley.edu/~selfpace/sp.unix.stuff/awk.pdf Written by the "K" of K&R, Aho, and Weinberger. Again, after reading this, I started becoming known as an Awk Black Belt.