How to get the parameter value from the parameter file in perl?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to get the parameter value from the parameter file in perl?
# 1  
Old 03-13-2013
How to get the parameter value from the parameter file in perl?

hi all,
i have a parameter file of following format, i want a method which can get the value of specific parameter.
parameter file format:
Code:
<Parameter Name="FileLocationWindows">
                <Description>
                    The directory location of the logger file.
                </Description>
                <Type>String</Type>
                <Restriction>
                    <RequiresRestart>false</RequiresRestart>
                    <Level>1</Level>
                    <MinVal/>
                    <MaxVal/>
                    <MaxLength>1000</MaxLength>
                    <Mandatory>true</Mandatory>
                    <Lov/>
                </Restriction>
                <Value>
                    <Item Value="logs"/>
                </Value>
            </Parameter>
            <Parameter Name="FileLocationUnix">
                <Description>
                    The directory location of the logger file.
                </Description>
                <Type>String</Type>
                <Restriction>
                    <RequiresRestart>false</RequiresRestart>
                    <Level>1</Level>
                    <MinVal/>
                    <MaxVal/>
                    <MaxLength>1000</MaxLength>
                    <Mandatory>true</Mandatory>
                    <Lov/>
                </Restriction>
                <Value>
                    <Item Value="/var/cti/logs/sitebook"/>
                </Value>
            </Parameter>

for example the value of parameter FileLocationUnix is /var/cti/logs/sitebook.

i want a method (getParameterValue("paramtername","parameterFileLocation")) which will return the value.
please help.

Last edited by joeyg; 03-13-2013 at 09:57 AM.. Reason: Please wrap code and data inside CodeTags
# 2  
Old 03-13-2013
Take a look at perl's XML::XPath module.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Call Script with Parameter (that has another parameter)

Hi. How do I achieve this sh /EDWH-DMT02/script/MISC/exec_sql.sh "@/EDWH-DMT02/script/others/CSM_CKC/Complete_List.sql ${file_name}" Complete_List.txt The /EDWH-DMT02/script/MISC/exec_sql.sh has two parameters and it's working fine with this sh /EDWH-DMT02/script/MISC/exec_sql.sh... (7 Replies)
Discussion started by: aimy
7 Replies

2. Shell Programming and Scripting

Resolving a parameter which is passed as parameter

Hi, I have the following files. ->cat scr.sh export TMP_DIR=/home/user/folder1 export TMP_DIR_2=/home/user/folder2 while read line do cat "$line" done<file_list.dat ------------------------ -> cat file_list.dat $TMP_DIR/file1.txt $TMP_DIR_2/file2.txt --------------------------- -> cat... (6 Replies)
Discussion started by: barath
6 Replies

3. Shell Programming and Scripting

Passing parameter to script, and split the parameter

i am passing input parameter 'one_two' to the script , the script output should display the result as below one_1two one_2two one_3two if then echo " Usage : <$0> <DATABASE> " exit 0 else for DB in 1 2 3 do DBname=`$DATABASE | awk -F "_" '{print $1_${DB}_$2}` done fi (5 Replies)
Discussion started by: only4satish
5 Replies

4. Shell Programming and Scripting

Command that takes one parameter and then searches for the passed in parameter

Hi I am looking for a unix command or a small shell script which can takes one parameter and then searches for the passed in the parameter in any or all files under say /home/dev/ Can anyone please help me on this? (3 Replies)
Discussion started by: pankaj80
3 Replies

5. Shell Programming and Scripting

perl script - command line parameter

i am a beginner, i want to make a program that takes any command line arguments... and print it out in reverse. ie. if the command line argument is "thanks for helping me" i want it to output "me helping for thanks" :D i have tried using the reverse command, but i cant get it working!! ... (3 Replies)
Discussion started by: bshell_1214
3 Replies

6. Shell Programming and Scripting

get system date, format it, pass it as a parameter to a perl script - all in cron job

I am trying to get the string containing date - in a specfic format actually, although I think that part is inconsequencial - 1110226^1110226^1110226^1110226^1110226 - through echo or printf or in some other way - created within a cront job and passed as a parameter to a perl script. Now, I know... (3 Replies)
Discussion started by: v8625
3 Replies

7. Shell Programming and Scripting

perl : merging two arrays on basis of common parameter

I have 2 arrays, @array1 contains records in the format 1|_|X|_|ssd|_| 4|_|H|_|hbd|_| 9|_|Y|_|u8gjdfg|_| @array2 contains records in the format X|_|asdf|_| Y|_|qwer|_| A|_|9kdkf|_| @array3 should contain records in the PLz X|_|ssd|_|asdf|_| Y|_|hdb|_|qwer|_| PLZ dont use... (2 Replies)
Discussion started by: centurion_13
2 Replies

8. Shell Programming and Scripting

How to use parameter with perl function?

am a beginer of shell Unix, plesase tell me how to get parameter with $perl in loop $ perl -lne '$/="DOCEND";print $_."DOCEND" if /$ACC/' file_input > output i can't get parameter in loop with perl fucntion like this pass paramerter to $ACC not accept in this script $ACC = paramerter to... (4 Replies)
Discussion started by: krai
4 Replies

9. Shell Programming and Scripting

Perl parameter passing between scripts

Hi All, I have two perl scripts say A.pl and B.pl. A.pl interacts with Database and pulllls around 20 column-variables, which needs to be used in B.pl . A.pl calls B.pl, I figured out that there exist a limit on number of arguments being passed as command line argument. A.pl writing to a... (3 Replies)
Discussion started by: coolbhai
3 Replies

10. Shell Programming and Scripting

how do I make dynamic parameter names? Or get the value of a parameter evaluated twi

Say I write something like the following: var1=1 var2=2 for int in 1 2 do echo "\$var$int" done I want the output to be: 1 2 Instead I get something like: $var1 $var2 (2 Replies)
Discussion started by: Awanka
2 Replies
Login or Register to Ask a Question