> Can we see a version of your script?
How about just a couple snippets...there's no proprietary data but I
want to be on the safe side. The original script consisted of a bunch
of functions similar to the one below. When I first wrote this I
didn't know how to use sed very well, so I used variable substitution
to strip out the data I wanted:
So this function in bash:
function gettomcatserver ()
{
# Strip out the short hostname
remoteserver=$(grep remote.server.host $adminfile)
remoteserver=${remoteserver##*=}
remoteserver=${remoteserver%%.*}
echo $remoteserver
}
Became this function in python:
def gettomcatserver( customername ):
for line in open(adminfile).readlines():
if line.startswith("remote.server.host="):
return line.split("remote.server.host=")[1].split(".example.com")[0]
The total script runs several functions like this for each
$customername; I was quite impressed with the difference in speed.
_______________________________________________
Tutor maillist - [email protected]
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor