Highlighted
hpemc
6 Indium

Perl or Python for scripting/automation/reading or writing to XML Files.

Hi,

I am currently working as a SAN Administrator. There may be some need for automation in my work and hence am planning to learn a scripting language.Tried playing around with Perl and Python for a few days (Very limited time). I had toyed with Perl earlier but found the syntax a little difficult to remember. Python on the other hand seems to have easier syntax. What I want to know is:

1) Which is better at redirecting the command output and filtering through it?

Lets say I want to redirect the output of symdev -sid 1234 list -noports in such a way that the output will show something like

Number of RAID 5 33 GB Devices = 10

Number of RAID 1 66 GB Devices = 20

Considering that I already have 33 or 66 GB Metas, but just need to count the field in the symdev list output so that it can be stored to a variable or an array and I can get to know how many devices I have.

2) Automation of mapping - suppose the output of symcfg -sid 1234 -list -address -available -dir 7B -p 0 shows that I have LUN IDs free from 5 to A and then again from C to 12 (it will show *5 and in the next line A and again C* and in the next line 12) , and I have to let the script generate the hex LUN IDs, which is better suited?

3) Suppose I have XML File that contains the output of symdev command (using the option to redirect the command output to an XML File ) and read the information, like say, device names from that and do some operations on it, which language is better suited?

4) Which language is more used ? Which has more demand ? Which will be a good choice in the long run?

All of my SAN Management Servers are windows, so I can't use grep and awk. I could install cygwin or windows version of gawk and grep, but looking for a langugage that will allow me to do this.

I have been through the "Integrating Perl for Advanced SYMCLI Scripting and Interpreting XML Output" post. Found that Perl syntax is a little cryptic to understand, however, if learning Perl will be a better choice, then I am ready to invest the time. I can only concentrate on one language due to work commitments etc...

I will be thankful if someone could answer me.

Moved to Symmetrix Forum as most of the questions here are for Symmetrix.

Labels (1)
0 Kudos
1 Reply
8 Krypton

Re: Perl or Python for scripting/automation/reading or writing to XML Files.

i use bash (cygwin) and perl , one liners are easy with bash but other script i do in perl. I don't use XML but simply scrape standard out.