Sponsored Content
Top Forums Shell Programming and Scripting Scripting question, replacement in xml file Post 302734037 by Ashu_099 on Wednesday 21st of November 2012 11:48:37 AM
Old 11-21-2012
Hi Birei,

Well,
I have long XML file and i want to replace XML twig that start with Text Id=98,12 and many more ..

Is it possible to give the input from external file.

In Perl code you mentioned only one Id=98 ( @id="98" )

q{Text[@Id="98"]/Language}
I want to add more Id and i want to give list of Id from external file from where its read example

cat Text Id_file
98
12
10
55
..
..
..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

sed xml file multiple line replacement

I have a file called config.xml, it's a simple xml file, and I need use sed/awk to erase some lines. <machine xsi:type="unix-machineType"> <name>server1</name> <node-manager> <name>server1</name> <listen-address>server1</listen-address> </node-manager> ... (3 Replies)
Discussion started by: cbo0485
3 Replies

2. Shell Programming and Scripting

XML tag replacement from different XML file

We have 2 XML file 1. ORIGINAL.xml file and 2. ATTRIBUTE.xml files, In the ORIGINAL.xml we need some modification as <resourceCode>431048</resourceCode>under <item type="Manufactured"> tag - we need to grab the 431048 value from tag and pass it to database table in unix shell script to find the... (0 Replies)
Discussion started by: balrajg
0 Replies

3. Shell Programming and Scripting

XML to Text file Parsing Using shell scripting

Hi folks, Need some help with XML to text file parsing , the following is the content of the XML File. <xn:SubNetwork id="SNJNPRZDCR0R03"> <xn:MeContext id="PRSJU0005"> <xn:VsDataContainer id="PRSJU0005"> <xn:attributes> ... (6 Replies)
Discussion started by: tech_frk
6 Replies

4. Solaris

XML to Text file Parsing Using shell scripting

Hi, I want to parse an XML File using Shell Script preferably by using awk command, I/P file is : <gn:ExternalGsmCell id="016P3A"> <gn:attributes> <gn:mnc>410</gn:mnc> <gn:mcc>310</gn:mcc> <gn:lac>8016</gn:lac> ... (2 Replies)
Discussion started by: tech_frk
2 Replies

5. UNIX for Dummies Questions & Answers

Delete a record in a xml file using shell scripting

find pattern, delete line with pattern and 3 lines above and 8 lines below the pattern. The pattern is "isup". The entire record with starting tag <record> and ending tag </record> containing the pattern is to be deleted and the rest to be retained. <record> ... (4 Replies)
Discussion started by: sdesstp
4 Replies

6. Shell Programming and Scripting

XML id replacement with shell

Hi.. I have a problem with replacing of id-0f5435080b with some name daily, problem here is whenever I generate xml file it generates unique id for instance say for example today id-0f5435080b and tomorrow it may be id-0f68643508so basically I just want to replace this id with some name say... (5 Replies)
Discussion started by: nex_asp
5 Replies

7. HP-UX

XML tag name content replacement

Hi, Need to replace an XML tag name contents, please provide any suggestions. Scenario is : <abc_def>Value_some_content</abc_def> Expected output : <abc:def>Value_some_content</abc:def> We have many tag with different names & contents in a file or a string. Please help on the... (3 Replies)
Discussion started by: periyasamycse
3 Replies

8. Shell Programming and Scripting

How to extract data from xml file using shell scripting?

Hi evry1, This is my 1st post in this forum.Pls help me I want to extract some data froma xml file which has 2000 lines using shell scripting. Actually my xml file has some "audio and video codes" which i need to arrange in a column wise format after extracting it using shell scripting.I... (4 Replies)
Discussion started by: arun_kohan
4 Replies

9. Shell Programming and Scripting

How to extract data from XML file using shell scripting?

Hi , I have input file as XML. following are input data #complex.xml Code: <?xml version="1.0" encoding="UTF-8"?><TEST_doc xmlns="http://www.w3.org/2001/XMLSchema-instance"> <ENTRY uid="123456"> <protein> <name>PROT001</name> <organism>Human</organism> ... (1 Reply)
Discussion started by: arun_kohan
1 Replies

10. Shell Programming and Scripting

XML data replacement

I have below lines in a file <SubRecord> <Property Name="Name">QQQQQQQQ</Property> <Property Name="Prompt">YYYYYYYYYY</Property> <Property Name="Default">$ddd</Property> <Property Name="HelpTxt">blahblah</Property> <Property Name="ParamType">4</Property> <Property... (8 Replies)
Discussion started by: ratheeshjulk
8 Replies
XML::Grove::AsString(3) 				User Contributed Perl Documentation				   XML::Grove::AsString(3)

NAME
XML::Grove::AsString - output content of XML objects as a string SYNOPSIS
use XML::Grove::AsString; # Using as_string method on XML::Grove::Document or XML::Grove::Element: $string = $xml_object->as_string OPTIONS; $string = $element->attr_as_string $attr, OPTIONS; # Using an XML::Grove::AsString instance: $writer = new XML::Grove::AsString OPTIONS; $string = $writer->as_string($xml_object); $writer->as_string($xml_object, $file_handle); DESCRIPTION
Calling `"as_string"' on an XML object returns the character data contents of that object as a string, including all elements below that object. Calling `"attr_as_string"' on an element returns the contents of the named attribute as a string. Comments, processing instructions, and, by default, entities all return an empty string. OPTIONS may either be a key-value list or a hash containing the options described below. OPTIONS may be modified directly in the object. The default options are no filtering and entities are mapped to empty strings. OPTIONS
Filter `"Filter"' is an anonymous sub that gets called to process character data before it is appended to the string to be returned. This can be used, for example, to escape characters that are special in output formats. The `"Filter"' sub is called like this: $string = &$filter ($character_data); EntityMap `"EntityMap"' is an object that accepts `"lookup"' methods or an anonymous sub that gets called with the entity replacement text (data) and mapper options as arguments and returns the corresponding character replacements. It is called like this if it is an object: $replacement_text = $entity_map->lookup ($entity_data, $entity_map_options); or this if it is a sub: $replacement_text = &$entity_map ($entity_data, $entity_map_options); EntityMapOptions `"EntityMapOptions"' is a hash passed through to the `"lookup"' method or anonymous sub, the type of value is defined by the entity mapping package or the anonymous sub. EntityMapFilter `"EntityMapFilter"' is a flag to indicate if mapped entities should be filtered after mapping. EXAMPLES
Here is an example of entity mapping using the Text::EntityMap module: use Text::EntityMap; use XML::Grove::AsString; $html_iso_dia = Text::EntityMap->load ('ISOdia.2html'); $html_iso_pub = Text::EntityMap->load ('ISOpub.2html'); $html_map = Text::EntityMap->group ($html_iso_dia, $html_iso_pub); $element->as_string (EntityMap => $html_map); AUTHOR
Ken MacLeod, ken@bitsko.slc.ut.us SEE ALSO
perl(1), XML::Grove(3) Extensible Markup Language (XML) <http://www.w3c.org/XML> perl v5.16.3 1999-08-25 XML::Grove::AsString(3)
All times are GMT -4. The time now is 01:00 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy