On Tue, Jan 06, 2009, Spiro Harvey wrote:
Why not just start with perl which does more than sed/awk while using similar syntax (if you want)?
This is why:
awk '/^[[:space:]]*word/ {print}' logfile
vs
perl -ne 'if (/^\s*word/) { print $_; }' logfile
Which syntax is likely to be easier to remember?
It depends entirely on what you want to do. For on-liners, sed, awk, and grep, and pcregrep (grep using perl regular expression syntax which is considerably more concise than [:space:] and friends) are often the best tools. For anything more complex, scripting languages such as python and perl are generally more flexible and easier to use.
I used to some pretty complex shell and awk scripts before learning perl about 20 years ago. Perl allowed me to do most things in a single language including fairly low-level system calls that I previously had to do with compiled ``C'' programs.
I have switched all of my new development primarily to python which I find far cleaner than perl, and easier to use for large projects. Python uses perl regular expression syntax so the transition was pretty painless.
Bill