Sponsored Content
Top Forums Shell Programming and Scripting Scripting question, replacement in xml file Post 302733947 by Ashu_099 on Wednesday 21st of November 2012 10:17:05 AM
Old 11-21-2012
Scripting question, replacement in xml file

Hi Anybody can help me to make a script that replace string "Su saldo es" with "Your balance" in XML block if it start with Text Id=98 and Text Id= 12 only sample of part of file below

Code:
<Text Id="98">
 <Language id="1">Su saldo es $mainAccountBalance1Tiene ademas $dedicatedAccount1Balance1 mensajes de texto</Language>
 <Language id="2"></Language>
 <Language id="3">Su saldo es $mainAccountBalance1Tiene ademas $dedicatedAccount1Balance1 mensajes de texto</Language>
 <Language id="4">Su saldo es $mainAccountBalance1Tiene ademas $dedicatedAccount1Balance1 mensajes de texto</Language>
 </Text>
 <Text Id="96"> 
<Language id="1">Su saldo es $mainAccountBalance1.</Language>
 <Language id="2">Su saldo es $mainAccountBalance1.</Language>
 </Text>
 <Text Id="12"> 
<Language id="1">Su saldo es $mainAccountBalance1.</Language>
 <Language id="2">Your balance  $mainAccountBalance1.</Language> 
</Text>


Last edited by Ashu_099; 11-28-2012 at 12:08 PM.. Reason: code tags...
 

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::TMX::Writer(3pm)					User Contributed Perl Documentation				     XML::TMX::Writer(3pm)

NAME
XML::TMX::Writer - Perl extension for writing TMX files SYNOPSIS
use XML::TMX::Writer; my $tmx = new XML::TMX::Writer(); $tmx->start_tmx(id => 'paulojjs'); $tmx->add_tu(SRCLANG => 'en', 'en' => 'some text', 'pt' => 'algum texto'); $tmx->add_tu(SRCLANG => 'en', 'en' => 'some text', 'pt' => 'algum texto', -note => [32, 34 ], -prop => { q => 23, aut => "jj"} ); $tmx->end_tmx(); DESCRIPTION
This module provides a simple way for writing TMX files. METHODS
The following methods are available: new $tmx = new XML::TMX::Writer(); Creates a new XML::TMX::Writer object start_tmx $tmx->start_tmx(-output => 'some_file.tmx'); Begins a TMX file. Several options are available: -output Output of the TMX, if none is defined stdout is used by default. tool Tool used to create the TMX. Defaults to 'XML::TMX::Writer' toolversion Some version identification of the tool used to create the TMX. Defaults to the current module version segtype Segment type used in the <tu> elements. Possible values are block, paragraph, sentence and phrase. Defaults to sentence. srctmf Specifies the format of the translation memory file from which the TMX document or segment thereof have been generated. adminlang Specifies the default language for the administrative and informative elements <note> and <prop>. srclang Specifies the language of the source text. If a <tu> element does not have a srclang attribute specified, it uses the one defined in the <header> element. Defaults to *all*. datatype Specifies the type of data contained in the element. Depending on that type, you may apply different processes to the data. The recommended values for the datatype attribute are as follow (this list is not exhaustive): unknown undefined alptext WinJoust data cdf Channel Definition Format cmx Corel CMX Format cpp C and C++ style text hptag HP-Tag html HTML, DHTML, etc interleaf Interleaf documents ipf IPF/BookMaster java Java, source and property files javascript JavaScript, ECMAScript scripts lisp Lisp mif Framemaker MIF, MML, etc opentag OpenTag data pascal Pascal, Delphi style text plaintext Plain text (default) pm PageMaker rtf Rich Text Format sgml SGML stf-f S-Tagger for FrameMaker stf-i S-Tagger for Interleaf transit Transit data vbscript Visual Basic scripts winres Windows resources from RC, DLL, EXE xml XML xptag Quark XPressTag srcencoding All TMX documents are in Unicode. However, it is sometimes useful to know what code set was used to encode text that was converted to Unicode for purposes of interchange. This option specifies the original or preferred code set of the data of the element in case it is to be re-encoded in a non-Unicode code set. Defaults to none. id Specifies the identifier of the user who created the element. Defaults to none. -note A reference to a list of notes to be added in the header. -prop A reference fo a hash of properties to be added in the header. Keys are used as the "type" attribute, value as the tag contents. add_tu $tmx->add_tu(srclang => LANG1, LANG1 => 'text1', LANG2 => 'text2'); $tmx->add_tu(srclang => LANG1, LANG1 => 'text1', LANG2 => 'text2', -note => ["value1", ## notes "value2"], -prop => { type1 => ["value1","value"], #multiple values _ => 'value2', # anonymound properties typen => ["valuen"],} ); Adds a translation unit to the TMX file. Several optional labels can be specified: id Specifies an identifier for the <tu> element. Its value is not defined by the standard (it could be unique or not, numeric or alphanumeric, etc.). srcencoding Same meaning as told in start_tmx method. datatype Same meaning as told in start_tmx method. segtype Same meaning as told in start_tmx method. srclang Same meaning as told in start_tmx method. end_tmx $tmx->end_tmx(); Ends the TMX file, closing file handles if necessary. SEE ALSO
TMX Specification <http://www.lisa.org/tmx/tmx.htm> AUTHOR
Paulo Jorge Jesus Silva, <paulojjs@bragatel.pt> Alberto Simo~es, <albie@alfarrabio.di.uminho.pt> COPYRIGHT AND LICENSE
Copyright 2003 by Projecto Natura This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.14.2 2012-06-05 XML::TMX::Writer(3pm)
All times are GMT -4. The time now is 04:17 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy