Sponsored Content
Top Forums Shell Programming and Scripting How to Append the specific data to the xml file Post 302303561 by ravi_rn on Friday 3rd of April 2009 02:01:02 AM
Old 04-03-2009
PHP

Actually my problem is, i have a data like below
<impl name="Nortel" is-enabled="true">
<package-mappings>
<const-mapping target-state="EndPoint"
target-param="cfCNDSubscribed" constant-value="true"/>
<const-mapping target-state="EndPoint"
target-param="cfCWSubscribed" constant-value="true"/>
<const-mapping target-state="EndPoint"
target-param="cfCFVSubscribed" constant-value="true"/>
<const-mapping target-state="EndPoint"
target-param="cfCFBLSubscribed" constant-value="true"/>
<const-mapping target-state="EndPoint"
target-param="cfCFDASubscribed" constant-value="true"/>
<const-mapping target-state="EndPoint"
</package-mappings>
<attribute max-instances="1" min-instances="0">
<simple-attribute name="lineNumber" type="string"
sub-type="number" is-key-field="false" is-package-defined="false">
<description>Telephone Number.</description>
<help>Subscriber's Telephone Number. </help>
</simple-attribute>
</attribute>

<attribute ....
</attribute>

</impl>

i want to the below data after </package-mappings> and above <attribute tag

below is the regular expression i am using to add but it is adding above
<package-mappings> but i have to add after </package-mappings>

The script i am using is
cat $i|sed '/\(.*<impl name=\"NueraWithNortel\" *is-enabled=\"true\".*\)/{
N
s:\(.*<impl name=\"NueraWithNortel\" *is-enabled=\"true\".*\)\n\( *\)<package-mappings>.*$:\1\
\2<attribute max-instances="1" min-instances="0">\
\2 <simple-attribute name="securityLevel" type="number"\
\2 is-key-field="false" is-package-defined="false">\
\2 <description>securityLevel</description>\
\2 <help>security level of the end pont</help>\
\2 </simple-attribute>\
\2</attribute>\
\2<package-mappings>:
}'
Please help me in resolving the issue
thank you very much in advance.
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

extract specific data from xml format file.

Hi, I need to extract the start time value (bold, red font) under the '<LogEvent ID="Timer Start">' tag (black bold) from a file with the following pattern. There are other LogEventIDs listed in the file as well, making it harder for me to extract out the specific start time that I need. . .... (7 Replies)
Discussion started by: 60doses
7 Replies

2. Shell Programming and Scripting

get the data from sybase and append to the file

How to get the data from the sybase database and append the data obtained into the file. For example, I will get the filename 'temp' from the database. This filename is associated with the number 1.6... This number 1.6 needs to be copied into the file that matches the filename in the... (1 Reply)
Discussion started by: vinay123
1 Replies

3. UNIX for Dummies Questions & Answers

append data to file

i want to develop a script newdata that writes new data to a file called items the file items has the following headings columns separated by tabs: channel date time programe if i type executable file newdata on the command line with parameters, it should append it to the items files the... (1 Reply)
Discussion started by: fletcher
1 Replies

4. Shell Programming and Scripting

read from a specific pattern from one file and append it to another

Hi! Everyone, Say this file1 -------------- line 1 51610183 420001010 0010CTCTLEDPPOO 2151610183 line 2 2151610183 420001010 0030A2TH2 line 3 2151610183 420001010 0040A2TH3 line 4 2151610183 420001010 ... (0 Replies)
Discussion started by: kinkar_ghosh
0 Replies

5. Shell Programming and Scripting

want to append the data in one file to the another

Hi , i have two log files, i need to combine this as a one log file. i need to do this by SED , test1.log sadadadaadfsaf test2.log adadadadadada i need this in a single file from test 1 to test2.log test2.log(expected result) adadadadadada (7 Replies)
Discussion started by: mhdmehraj
7 Replies

6. Shell Programming and Scripting

sed to append on specific line in password file

I have the a group file and my ftp group line looks like this ... (3 Replies)
Discussion started by: slufoot80
3 Replies

7. Shell Programming and Scripting

Overwrite specific column in xml file with the specific column from adjacent line

I have an xml file dumped from rrd file, that I want to "patch" so the xml file doesn't contain any blank hole in the resulting graph of the rrd file. Here is the file. <!-- 2015-10-12 14:00:00 WIB / 1444633200 --> <row><v> 4.0419731265e+07 </v><v> 4.5045912770e+06... (2 Replies)
Discussion started by: rk4k
2 Replies

8. Shell Programming and Scripting

Append a specific keyword in a text file into a new column

All, I have some sample text file(.csv) in the below format. In my actual file there are at least 100K rows. date 03/25/2016 A,B,C D,E,F date 03/26/2016 1,2,3 4,5,6 date 03/27/2016 6,4,3 4,5,6 I require the following output where in the date appeared at different locations need to... (3 Replies)
Discussion started by: ks_reddy
3 Replies

9. Shell Programming and Scripting

Moving XML tag/contents after specific XML tag within same file

Hi Forum. I have an XML file with the following requirement to move the <AdditionalAccountHolders> tag and its content right after the <accountHolderName> tag within the same file but I'm not sure how to accomplish this through a Unix script. Any feedback will be greatly appreciated. ... (19 Replies)
Discussion started by: pchang
19 Replies
XML-XPARSE(1)							   User Commands						     XML-XPARSE(1)

NAME
xml-xparse - Parse XML documents with entity and URI resolution SYNOPSIS
xml-xparse [options] xmlfile DESCRIPTION
xml-xparse is a simple command line tool for parsing and validating XML documents. It is not an actual XML parser, it just wraps around a JAXP Parser, adding support for catalog-based entity and URI resolution. OPTIONS
-c catalogfile Load a particular catalog file. May be specified multiple times. -v Perform a validating parse. This is the default. -w Perform a well-formed parse, not a validating parse. -N Perform a namespace-aware parse. This is the default. -n Perform a namespace-ignorant parse. -d debuglevel Set the debug level (an integer). Warnings are shown if the debug level is set to greater than 2. -E maxerrors Set the maximum number of errors to display. The default is 10. FILES
/etc/java/resolver/CatalogManager.properties The central catalog manager configuration file used by xml-xparse. SEE ALSO
xml-xread(1), xml-resolver(1), java(1), the OASIS entity resolution technical committee home page at <http://www.oasis-open.org/commit- tees/entity/>. AUTHOR
Norman Walsh <Norman.Walsh@Sun.COM> 1.1 July 2004 XML-XPARSE(1)
All times are GMT -4. The time now is 05:46 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy