Unix/Linux Go Back    


Shell Programming and Scripting BSD, Linux, and UNIX shell scripting — Post awk, bash, csh, ksh, perl, php, python, sed, sh, shell scripts, and other shell scripting languages questions here.

wrapper script in perl

Shell Programming and Scripting


Closed    
 
Thread Tools Search this Thread Display Modes
    #1  
Old Unix and Linux 03-23-2009
richsark richsark is offline
Registered User
 
Join Date: Feb 2009
Last Activity: 10 February 2016, 9:34 PM EST
Posts: 135
Thanks: 7
Thanked 0 Times in 0 Posts
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
Sponsored Links
    #2  
Old Unix and Linux 03-23-2009
KevinADC KevinADC is offline Forum Advisor  
Registered User
 
Join Date: Jan 2008
Last Activity: 11 September 2009, 3:44 PM EDT
Posts: 729
Thanks: 0
Thanked 0 Times in 0 Posts
What have you tried? Where are you stuck?
Sponsored Links
    #3  
Old Unix and Linux 03-23-2009
richsark richsark is offline
Registered User
 
Join Date: Feb 2009
Last Activity: 10 February 2016, 9:34 PM EST
Posts: 135
Thanks: 7
Thanked 0 Times in 0 Posts
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;
    #4  
Old Unix and Linux 03-23-2009
KevinADC KevinADC is offline Forum Advisor  
Registered User
 
Join Date: Jan 2008
Last Activity: 11 September 2009, 3:44 PM EDT
Posts: 729
Thanks: 0
Thanked 0 Times in 0 Posts
run it and see if it works
Sponsored Links
    #5  
Old Unix and Linux 03-23-2009
richsark richsark is offline
Registered User
 
Join Date: Feb 2009
Last Activity: 10 February 2016, 9:34 PM EST
Posts: 135
Thanks: 7
Thanked 0 Times in 0 Posts
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?
Sponsored Links
    #6  
Old Unix and Linux 03-23-2009
KevinADC KevinADC is offline Forum Advisor  
Registered User
 
Join Date: Jan 2008
Last Activity: 11 September 2009, 3:44 PM EDT
Posts: 729
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by richsark View Post
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.
Sponsored Links
Closed

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Linux More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Help with a wrapper script not working richsark Shell Programming and Scripting 0 03-09-2009 01:49 PM
Korn Shell Wrapper script pareshan Shell Programming and Scripting 6 12-23-2008 12:56 PM
New wrapper script will be developed to wrap two ksh scripts ishai82 Shell Programming and Scripting 3 03-17-2008 04:45 AM
What is a wrapper script thana UNIX for Dummies Questions & Answers 1 01-28-2008 07:11 AM
What is wrapper script and how to write chiru UNIX for Dummies Questions & Answers 1 06-12-2006 05:23 AM



All times are GMT -4. The time now is 12:51 AM.