wrapper script in perl

Hi,

I am in need of way to facilitate this senerio in a perl script.

I have CLI ( command line interface) which I run like so:

kip-tepltist -u Xxx -p Xxx

Which produces tones of names from each template it found:

194Iselin-NJ
33-IDFLB-North-611-Woodward-8600
34-IDFMBS-611-Woodward-860004-Vo
CAF-10.41.22
ukgla.ops.sun4us.bk
ukgla.ops.sun4us.prd

Basically the cli above is grabbing template information and spitting out the names of each and every template

Now that I have this list from above, I then need to run another CLI that gets the information of whats inside of each template from above. The CLI is use for this is:

./qip-getteinfo -U xx -P xx -n 194Iselin-NJ -t -o orig

The flags are:
U & P are user name and passwd
the -n is the name of the template I want to get its information
-t specifey what type of template
-o org id

So when I run this cli agianst 194Iselin-NJ the output looks like so:

template-name=194Iselin-NJ
template-type=DHCP Option Template
001=Same as in Subnet Profile
003=Same as in Subnet Profile
006=User Defined
006>User Defined=169.30.33.16 169.30.34.16
012=Same as in Object Profile
015=Same as in Subnet Profile
043=uktrq-uut-son4v-bk
051=Limited
051>Limited Lease Time=43200
066=169.30.34.62
186=169.30.34.62
187=[1f51]

What I need is a way to automate this.

I need a perl script that will run the first step, keep the names it finds some where on a text file perhaps,

Then run the next step, to reference the file names from step 1 and create a seperate file with the contents of all the names from step 1

So,

Run first part of the perl script
get the names of all the templates,

Second part of the perl script would reference the files from the first section and make a list .txt

so, the first one would be:
194Iselin-NJ

grab the contents and produce a file name 194Iselin-NJ.txt that would contain the template information of:

template-name=194Iselin-NJ
template-type=DHCP Option Template
001=Same as in Subnet Profile
003=Same as in Subnet Profile
006=User Defined
006>User Defined=169.30.33.16 169.30.34.16
012=Same as in Object Profile
015=Same as in Subnet Profile
043=uktsq-ops-sun4v-bk
051=Limited
051>Limited Lease Time=43200
066=169.30.34.62
186=169.30.34.62
187=[1f51]

Then loop and go to the next and so, on... until all the names and templates are created.

Thanks

What have you tried? Where are you stuck?

Hi,

I have this perl script, but not sure if it will do what I want.

This script would require me to run the first step by hand, and capture the output called "plates.txt"

Then use (part) of this script to do the rest, ( I am not sure that this will do the job) as its CHOMP line 1, where the files has lots of lines

#!/usr/bin/perl -w

open FH1, 'plates.txt' or die "Cannot open plates.txt $!";

while ( $line1 = <FH1> ) {
chomp($line1); # remove new line character(s)
system("qip-getteinfo -U xx -P xx -n -t -o orig -a $line1 -o ABC >> log.txt 2>&1");
}
close FH1;

run it and see if it works

HI, Well, the script that I have was not meant for this task.

I simply need it modified to do the request I have submitted.

I am asking that the script I have be modified.

Can you help?

Sorry, can't help.