Sponsored Content
Top Forums Shell Programming and Scripting XML id replacement with shell Post 302760457 by nex_asp on Thursday 24th of January 2013 06:58:48 AM
Old 01-24-2013
Thanks srinivas matta, if I have to run
Code:
my 1st script daily at 10.00 am

and another script
Code:
weekly once say 11.00 am

and one more script monthly once
Code:
 12.00 am

automatically means, what I need to do.

---------- Post updated at 05:25 AM ---------- Previous update was at 04:38 AM ----------

Sorry again noticed one more problem output coming like this

Code:
<grmy_datafileme-my_datafile>
    <link match="/lasdata/axes/lon-x-my_datafile" />
    <link match="/lasdata/axes/lat-y-my_datafile" />
    <link match="/lasdata/axes/time-t-my_datafile" />
  </grmy_datafileme-my_datafile>
</grids>

it was supposed to be
Code:
<grids>
  <grid-lon-lat-time-my_datafile>
    <link match="/lasdata/axes/lon-x-my_datafile" />
    <link match="/lasdata/axes/lat-y-my_datafile" />
    <link match="/lasdata/axes/time-t-my_datafile" />
  </grid-lon-lat-time-my_datafile>
</grids>

I think sed won't help from below code got some partial result

---------- Post updated at 05:59 AM ---------- Previous update was at 05:25 AM ----------

Code:
sed -e "s/<id-..........\=\"/<my_datafile\=\"/g" -e "s/-id-..........\>/-my_datafile/g" -e "s/<\/id-........../<\/my_datafile>/g"

but still can't trust like find and replace in editor, if any efficient method is available means please post a code.

---------- Post updated at 06:58 AM ---------- Previous update was at 05:59 AM ----------

Code:
awk '{ for (i=1; i<=NF; i++) if ($i ~ /id-/) print "field:", i, $i }' file

above one blindly..checks..
how can I search only id-................ and replace with my string.....

Last edited by nex_asp; 01-24-2013 at 07:34 AM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to remove xml namespace from xml file using shell script?

I have an xml file: <AutoData xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <Table1> <Data1 10 </Data1> <Data2 20 </Data2> <Data3 40 </Data3> <Table1> </AutoData> and I have to remove the portion xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" only. I tried using sed... (10 Replies)
Discussion started by: Gary1978
10 Replies

2. 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

3. Shell Programming and Scripting

Problems on cat and substring replacement, shell

Hi I'm new in the Shell world, and I've been trying the whole day to get my script to work. I'm under Ubuntu 10.04. Let me explain: I want to list all the files matching some regex in a directory, and then make some some string replacement on the name of the files, and then a cat on the... (2 Replies)
Discussion started by: albh
2 Replies

4. 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

5. Shell Programming and Scripting

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 <Text Id="98"> <Language id="1">Su saldo es $mainAccountBalance1Tiene ademas $dedicatedAccount1Balance1... (13 Replies)
Discussion started by: Ashu_099
13 Replies

6. 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

7. Shell Programming and Scripting

Shell Command to compare two xml lines while ignoring xml tags

I've got two different files and want to compare them. File 1 : HTML Code: <response ticketId="944" type="getQueryResults"><status>COMPLETE</status><description>Query results fetched successfully</description><recordSet totalCount="1" type="sms_records"><record... (1 Reply)
Discussion started by: Shaishav Shah
1 Replies

8. Shell Programming and Scripting

How to add Xml tags to an existing xml using shell or awk?

Hi , I have a below xml: <ns:Body> <ns:result> <Date Month="June" Day="Monday:/> </ns:result> </ns:Body> i have a lookup abc.txtt text file with below details Month June July August Day Monday Tuesday Wednesday I need a output xml with below tags <ns:Body> <ns:result>... (2 Replies)
Discussion started by: Nevergivup
2 Replies

9. 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

10. UNIX for Beginners Questions & Answers

How to pull multiple XML tags from the same XML file in Shell.?

I'm searching for the names of a TV show in the XML file I've attached at the end of this post. What I'm trying to do now is pull out/list the data from each of the <SeriesName> tags throughout the document. Currently, I'm only able to get data the first instance of that XML field using the... (9 Replies)
Discussion started by: hungryd
9 Replies
All times are GMT -4. The time now is 03:54 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy