hello sir,
my work is run version.sh file and collect the values of version and type in the output. i have around 500 servers,so i want to automate this process using pyhton. i had written sample code shown below, but it is not giving good results.will you please help me with correct code,
#!/usr/bin/python
import commands
import re
com = "sh version.sh"
output=commands.getoutput("com")
print outpu
result = re.findall(r"versio * | type*",output)
print result
print zip (*[ iter (result) ] *2)
print [tuple (x.strip() for x in y.split (" ")) for y in result]
ouput:
com: command not found
[]
[]
[]
and my version.sh file is like this
Product List
--------------------------------------------------------------------------------
Name HTTPD
Version 6.1.0.0
Installed Product
--------------------------------------------------------------------------------
Type PLG
Build Level b06.14
Build Date 5/16/06
--------------------------------------------------------------------------------
End Status Report
--------------------------------------------------------------------------------