python vs awk for simple sysamin tasks

William Park opengeometry at yahoo.ca
Fri Jun 4 21:32:25 CEST 2004


Steve Lamb <grey at despair.dmiyu.org> wrote:
> On 2004-06-04, Pete Forman <pete.forman at westerngeco.com> wrote:
> > That said, I still would agree with others in this thread that one
> > liners are useful.  It is a good idea to be familiar with awk, find,
> > grep, sed, xargs, etc.
> 
>     Then you, like some others, would have missed my point.  I never
>     said that one liners aren't useful.  I never said one should not
>     know the standard tools available on virtually all unix systems.
>     I said, quite clearly, that I felt *anything larger than a one
>     liner* should not be done in shell.
> 
>     That means one liners are cool in shell.  They serve a purpose.

I realize that this is Python list, but a dose of reality is needed
here.  This is typical view of salary/wage recipient who would do
anything to waste time and money.  How long does it take to type out
simple 2 line shell/awk script?  And, how long to do it in Python?

"Right tool for right job" is the key insight here.  Just as Python
evolves, other software evolves as well.  For array/list and
glob/regexp, I mainly use Shell now.  Shell can't do nesting (but don't
really need to).  For more complicate stuffs, usually involving heavy
dictionary, I use Python.  Awk would fall in between, usually involving
floating point and table parsing.

For OP, learn both Awk and Python.  But, keep in mind, shell and editor
are the 2 most important tools/skills.  Neither Awk or Python will do
you any good, if you can't type. :-)

-- 
William Park, Open Geometry Consulting, <opengeometry at yahoo.ca>
No, I will not fix your computer!  I'll reformat your harddisk, though.



More information about the Python-list mailing list