python vs awk for simple sysamin tasks

Steve Lamb grey at despair.dmiyu.org
Thu Jun 3 13:22:55 EDT 2004


On 2004-06-03, Matthew Thorley <ruach at chpc.utah.edu> wrote:
> It is A LOT longer than the one liners (obviously) but it has way more 
> functionality. With a little tweaking you could easily do all sorts of 
> other useful things. I'm sure utils like this already exist out there 
> whether written in python or not.

    Also it can be made part of a larger project with relative ease.  :)

> Another question. The example my friend gave me takes the user name as 
> an argument not the uid. Does any one know how to convert usernames to 
> uids and vice versa in python ?  Please also comment on the script, any 
> thoughts on simplification ?

    I'd just do a quick pass over the passwd file but then many times I'm
blisfully unaware of things already coded to do the work I'm after.  I mean my
first stab at iterating over the file system didn't use os.path.walk().  :)

-- 
         Steve C. Lamb         | I'm your priest, I'm your shrink, I'm your
       PGP Key: 8B6E99C5       | main connection to the switchboard of souls.
-------------------------------+---------------------------------------------



More information about the Python-list mailing list