03-09-2007
how to replace a text inside a file based on a xml key
<c-param>
<param-name>Number</param-name>
<param-value>22</param-value>
<description>my house number</description>
</c-param>
<c-param>
<param-name>Address</param-name>
<param-value>XYZ</param-value>
<description>my house Address</description>
</c-param>
I have a file and inside that there are lines as above. only unique key is the param-name ie. Number
Now i need to change the value of this param ie need to increase by 1 everytime whenever i run my script.
I am not able to find a direct way. can anyone tell me what is the best way.
1) there are multiple <c-param> in a file
2) there are <param-name> in a file but "Number" is different for each tab eg Number in one and Address in other
3) Value 22 can be some where else too so i need to update specifically related to Number only
Please let me know what is the best way
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi,
I have a situation where I want to replace some occurrences of ".jsp" into ".html" inside a text file.
For Example:
If a pattern found like <a href="http://www.mysite.com/mypage.jsp"> it should be retained.
But if a pattern found like <a href="../mypage.jsp"> it should be changed to... (4 Replies)
Discussion started by: meharo
4 Replies
2. Shell Programming and Scripting
Hi I'm trying to replace text in a file based upon a pattern.
The pattern I'm looking for is:
<styleURL>#style0002</styleURL>
<name>#######6105#######</name>The # are seven alphanumeric characters before and after 6105.
I need it to replace that with this recursively:
... (4 Replies)
Discussion started by: Grizzly
4 Replies
3. Shell Programming and Scripting
Replace these if the column is -
p = q
q = p
r = s
s = r
input
- PQRSSP
+ PQRS
output
- QPSRRQ
+ PQRS
Some thing,like (5 Replies)
Discussion started by: bumblebee_2010
5 Replies
4. Shell Programming and Scripting
I have a directory that has directories that contain Dir-20111114-xyz and I want to change them to Dir-20111121-xyz.
Inside of Dir-20111114-xyz, I have a config.xml file that also contains the date that I need changed from 20111114 to 20111121
I have used sed to replace inside of file not... (4 Replies)
Discussion started by: icculus99
4 Replies
5. Shell Programming and Scripting
Hi All,
I want to change the name as SEQ_13
ie., <Property Name="Name">SEQ_13</Property>
when the Stage Type is PxSequentialFile
ie., <Property Name="StageType">PxSequentialFile</Property> :wall:
Input.XML
<Main>
<Record Identifier="V0S13" Type="CustomStage" Readonly="0">... (3 Replies)
Discussion started by: kmsekhar
3 Replies
6. Shell Programming and Scripting
Hi,
I am looking for assistance over shell or perl (without XML twig module) which replace string in XML file under particular branch..example of code file sample..
Exact requirment : Replace "Su saldo es" in below file with "Your balance" but only in XML branch of Text id=98 and Text Id=12... (7 Replies)
Discussion started by: Ashu_099
7 Replies
7. Shell Programming and Scripting
Hi All,
We need to split a large xml into multiple valid xml with same header(2lines) and footer(last line) for N number of letterId.
In the example below we have first 2 lines as header and last line as footer.(They need to be in each split xml file)
Header:
<?xml version="1.0"... (5 Replies)
Discussion started by: vx04
5 Replies
8. Shell Programming and Scripting
I have a really big XML file. I need copy the value of one tag inside another one tag. I try to publish one example.
<channel update="i" site="merge-xmltv" site_id="" xmltv_id="Rai 1">Rai 1</channel>
<channel update="i" site="merge-xmltv" site_id="" xmltv_id="Rai 1 +2HD">Rai 1... (6 Replies)
Discussion started by: Tapiocapioca
6 Replies
9. Programming
Hello Team,
I have 2 files.one contains english text and another contains Japanese. so i have to read english text and replace the text with Japanesh text in third file.
Basically, I need a help to write japanese language in text/xml file.I heard wstring does this.Not sure how do i write... (2 Replies)
Discussion started by: SA_Palani
2 Replies
10. UNIX for Beginners Questions & Answers
Dear Unix guru,
I have a .XML file which is being used to load data to oracle. This file comes on unix box and one of the tag in xml is oracle key word. I want to find that tag and replace with new tag on the fly
For example
I will get one of the tag in xml is as below
<from>Test Test... (12 Replies)
Discussion started by: guddu_12
12 Replies
LEARN ABOUT DEBIAN
yaz-icu
YAZ-ICU(1) Commands YAZ-ICU(1)
NAME
yaz-icu - YAZ ICU utility
SYNOPSIS
yaz-icu [-c config] [-p opt] [-s] [-x] [infile]
DESCRIPTION
yaz-icu is utility which demonstrates the ICU chain module of yaz. (yaz/icu.h).
The utility can be used in two ways. It may read some text using an XML configuration for configuring ICU and show text analysis. This mode
is triggered by option -c which specififies the configuration to be used. The input file is read from standard input or from a file if
infile is specified.
The utility may also show ICU information. This is triggered by option -p.
OPTIONS
-c config
Specifies the file containing ICU chain configuration which is XML based.
-p type
Specifies extra information to be printed about the ICU system. If type is c then ICU converters are printed. If type is l available
locales are printed. If type is t available transliterators are printed.
-s
Specifies that output should include sort key as well. Note that sort key differs between ICU versions.
-x
Specifies that output should be XML based rather than "text" based.
ICU CHAIN CONFIGURATION
The ICU chain configuration speicifies one or more rules to convert text data into tokens. The configuration format is XML based.
The toplevel element must be named icu_chain. The icu_chain element has one required attribute locale which specifies the ICU locale to be
used in the conversion steps.
The icu_chain element must include elements where each element specifies a conversion step. The conversion is performed in the order in
which the conversion steps are specified. Each conversion element takes one attribute: rule which serves as argument to the conversion
step.
The following conversion elements are available:
casemap
Converts case and rule specifies how:
l
Lowercase using ICU function u_strToLower.
u
Upper case using ICU function u_strToUpper.
t
To title using UCU function u_strToTitle.
f
Fold case using ICU function u_strFoldCase.
display
This is a meta step which specifies that a term/token is to be displayed. This term is retrieved in an application using function
icu_chain_token_display (yaz/icu.h).
transform
Specifies an ICU transform rule using a transliterator Identifier. The rule attribute is the transliterator Identifier. See ICU
Transforms[1] for more information.
transliterate
Specifies a rule-based transliterator. The rule attribute is the custom transformation rule to be used. See ICU Transforms[1] for more
information.
tokenize
Breaks / tokenizes a string into components using ICU functions ubrk_open, ubrk_setText, .. . The rule is one of:
l
Line. ICU: UBRK_LINE.
s
Sentence. ICU: UBRK_SENTENCE.
w
Word. ICU: UBRK_WORD.
c
Character. ICU: UBRK_CHARACTER.
t
Title. ICU: UBRK_TITLE.
EXAMPLES
The following command analyzes text in file text using ICU chain configuration chain.xml:
cat text | yaz-icu -c chain.xml
The chain.xml might look as follows:
<icu_chain locale="en">
<transform rule="[:Control:] Any-Remove"/>
<tokenize rule="w"/>
<transform rule="[[:WhiteSpace:][:Punctuation:]] Remove"/>
<transliterate rule="xy > z"/>
<display/>
<casemap rule="l"/>
</icu_chain>
SEE ALSO
yaz(7)
ICU Home[2]
ICU Transforms[1]
NOTES
1. ICU Transforms
http://userguide.icu-project.org/transforms/general
2. ICU Home
http://www.icu-project.org/
YAZ 4.2.30 04/16/2012 YAZ-ICU(1)