![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| append data to file | fletcher | UNIX for Dummies Questions & Answers | 1 | 02-07-2009 07:08 AM |
| Using awk (or whatever) to pull and append data in a new file | Milano_EH3 | UNIX for Dummies Questions & Answers | 6 | 01-27-2009 05:10 PM |
| How to parse the specific data from the file | MuthuAlagappan | UNIX for Dummies Questions & Answers | 2 | 12-03-2008 07:46 AM |
| append data in a file by using tab delimiter | Sharmila_P | Shell Programming and Scripting | 6 | 07-31-2008 01:07 AM |
| get the data from sybase and append to the file | vinay123 | Shell Programming and Scripting | 1 | 06-13-2008 09:25 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
I have an xml file data as shown 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"/> </package-mappings> I want to append few line to the last that is after </package-mappings> i am using the following script but it seems to be not working cat File.xml|sed '/\(.*<impl name=\"Nortel\" *is-enabled=\"true\".*\)/{ N s:\(.*<impl name=\"Nortel\" *is-enabled=\"true\".*\)\n\( *\)<\/impl>.*$:\1\ \2<attribute max-instances="1" min-instances="0">\ \2 <simple-attribute name="securityLevel" type="number"\ \2is-key-field="false" is-package-defined="false">\ \2</attribute>: }' Please some one can help me out in the above issue. Thank you very much in advance |
|
||||
|
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. |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|