Sponsored Content
Top Forums Shell Programming and Scripting To read xml value depending on property Post 302442372 by javaholics on Wednesday 4th of August 2010 05:02:09 AM
Old 08-04-2010
To read xml value depending on property

Hi have some xml like this
Code:
<example>
    <Cell Name="Cell1" ConfigureHost="claas" Role="APPSERV,BACKEND">
      <Node Name="aaaaa" Role="APPSERV,BACKEND,CLM"/>
      <Node Name="vvvv" Role="APPSERV,BACKEND"/>
      <Mercury Type="default" FQDN="ssssss" 
PrimaryReturnFQDN=""/>
    </Cell>
    
  </example>

From shell i want to do somethign like this .If r Role="APPSERV,BACKEND,CLM" i want to set a variable v=aaaa
and Role="APPSERV,BACKEND" set variable k=vvvv

Please help regarding this I am new to shell

Thanks

Last edited by Franklin52; 08-04-2010 at 06:03 AM.. Reason: Please use code tags!
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Read xml file

Iam new to shell script. How to read xmlfile using shellscript(without awk),and Store record by record in file . My xml file: <root> <header> <HeaderData1>header1</HeaderData1> <HeaderData2>header2</HeaderData2> </header> <detailsRecord> ... (2 Replies)
Discussion started by: ram2s2001
2 Replies

2. Shell Programming and Scripting

Problem printing the property of xml file via shell script

Hi, I have a config.xml which cointains the tags like <CONFIG> <PROPERTY name="port" value="1111"/> <PROPERTY name="dbname" value="ABCDE"/> <PROPERTY name="connectstring" value="xyz/pwd"/> </CONFIG> This file is in some directory at UNix box. I need to write a... (4 Replies)
Discussion started by: neeto
4 Replies

3. UNIX Desktop Questions & Answers

read XML xml element with REGEXP

Hi, I would need to read an xml element from an xml file to a local variable. Please could you help me with a shell script to get so? Considering that I have a file called file.xml like below: <header> <description>This is the description</description> <content>This is the... (2 Replies)
Discussion started by: oscarmon
2 Replies

4. Shell Programming and Scripting

URGENT: Script/Function needed to read text property files in block wise

Hi, Iam in a need for a script/function in KSH where I want to read a text file (property file) in block by block. Here is the example: Heading Name Descripton Block Block1 Value1 Description Property Name Value Property Name Value Property Name Value Property Name Value Property Name... (7 Replies)
Discussion started by: ysreenivas
7 Replies

5. Shell Programming and Scripting

Read data in XML file

Hello Everybody, I have a question on reading the data from XML file through KSH shell script. In the below file I need to collect the patient control no and its respective insured id. I need to have pair of these values in single line separated by some special character, so that I could use... (2 Replies)
Discussion started by: swame_sp
2 Replies

6. Shell Programming and Scripting

script to read XML file

Dear All, I have one log file and it contains lot of XML as below. ... (1 Reply)
Discussion started by: murtujak
1 Replies

7. Shell Programming and Scripting

Help on awk to read xml file

Hello, I have a xml file as shown below. I want to parse the file and store data in variables. xml file looks like: <TEST NAME="DataBaseurl">jdbc:oracle:thin:@localhost:1521:ora10</TEST> <TEST NAME="Databaseuser">Pradeep</TEST> ...... and many other such lines i want to read this file and... (2 Replies)
Discussion started by: pradeepmacha
2 Replies

8. Shell Programming and Scripting

Report a missing property and property value mis match script.

Hi All, I have 2 properties files - one is a master templete and other one is a node specific properties file, I need to comapre these 2 properties files and make sure the node Specific properties file contains all the properties in the master temple properties file else report the missing... (5 Replies)
Discussion started by: jayka
5 Replies

9. Shell Programming and Scripting

[SOLVED] Read XML for solaris

Hello I have this script that works fine in Linux But not on sun solaris. Can some one help me with the awk syntax for solaris. Linux: awk -F $0~/DBURL/ {print $7} /tmp/test.xml---------- Post updated at 11:16 AM ---------- Previous update was at 11:05 AM ---------- Sorry guys i got the... (0 Replies)
Discussion started by: pradeepmacha
0 Replies

10. Shell Programming and Scripting

Read file excluding XML in it

Hi , I have a file like below.I want all the content in a single line excluding the XML.How can i proceed? t=21 y=23 rg=xyz ..... <xmlstarts> . . <xmlends> lk=99 lo=09 (3 Replies)
Discussion started by: chetan.c
3 Replies
MooseX::NonMoose::Meta::Role::Constructor(3pm)		User Contributed Perl Documentation	    MooseX::NonMoose::Meta::Role::Constructor(3pm)

NAME
MooseX::NonMoose::Meta::Role::Constructor - constructor method trait for MooseX::NonMoose VERSION
version 0.22 SYNOPSIS
package My::Moose; use Moose (); use Moose::Exporter; Moose::Exporter->setup_import_methods; sub init_meta { shift; my %options = @_; Moose->init_meta(%options); Moose::Util::MetaRole::apply_metaclass_roles( for_class => $options{for_class}, metaclass_roles => ['MooseX::NonMoose::Meta::Role::Class'], constructor_class_roles => ['MooseX::NonMoose::Meta::Role::Constructor'], ); return Class::MOP::class_of($options{for_class}); } DESCRIPTION
This trait implements inlining of the constructor for classes using the MooseX::NonMoose::Meta::Role::Class metaclass trait; it has no effect unless that trait is also used. See those docs and the docs for MooseX::NonMoose for more information. AUTHOR
Jesse Luehrs <doy at tozt dot net> COPYRIGHT AND LICENSE
This software is copyright (c) 2011 by Jesse Luehrs. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. perl v5.12.3 2011-05-09 MooseX::NonMoose::Meta::Role::Constructor(3pm)
All times are GMT -4. The time now is 01:53 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy