XML file: add 100 lines


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting XML file: add 100 lines
# 1  
Old 06-06-2009
XML file: add 100 lines

Hi Gurus,
I have XML file which i want to add 100 lines.I have no idea in xml how to add or modify data .Any help should be appreciated.


Thanks,
Akil
# 2  
Old 06-07-2009
Quote:
Originally Posted by akil
...
I have XML file which i want to add 100 lines....
Show an example of how your xml file looks like currently. And how it should look like after you've added those lines.

tyler_durden
# 3  
Old 06-07-2009
you can use vi or emacs editor.
# 4  
Old 06-07-2009
where you want to add?? inbetween or at the end or at the begining??
# 5  
Old 06-07-2009
Hi

Thanks for your replies,This my XML file looks like ,I want to add another 100 lines at end of the file with different CustCodes(1.10000633K,1.10000634K ...) and rest of the columns values are same.
Code:

<InvoiceDetails>
<InvHeader>
<CustId>633     </CustId><CustCode>1.10000632K             </CustCode><InvRefNum>0091207596042009</InvRefNum><Ohxact>           123781525</Ohxact><BillStartDt>20090316</BillStartDt><BillEndDt>20090331</BillEndDt><CuRecTot>        29.8322</CuRecTot><CuOTTot>         0.0000</CuOTTot><CuUsgTot>         0.0000</CuUsgTot><CuOccTot>         0.0000</CuOccTot><CuTotTax>         2.0900</CuTotTax><CuAdjAmt>         0.0000</CuAdjAmt><CuInvAmt>          31.92</CuInvAmt><CuPrevBal>        93.0200</CuPrevBal><CuPaymnt>         0.0000</CuPaymnt><CuBalance>       124.9400</CuBalance><CuDueDt>20090415</CuDueDt><CustName>MR CHANDRASEKARAN SEKARAN SIVAKUMAR                                        </CustName><BillCycle>26</BillCycle><InvDate>20090401</InvDate><CompanyName>486 ADMIRALTY LINK                      </CompanyName>
</InvHeader>
<CuTaxInfo>
<TxRunNum>                 1</TxRunNum><ClTMsd>R3G16</ClTMsd><TxTarifVer>2     </TxTarifVer><ClSPsd>SPG15</ClSPsd><ClSNsd>S0015</ClSNsd><ClTaxCatNm>GST Mobile - 7% (2007)        </ClTaxCatNm><CoTaxRate>7.00000  </CoTaxRate><CoTaxAmt>    -0.1694</CoTaxAmt>
</CuTaxInfo>

Thanks,
Akil
# 6  
Old 06-08-2009
This is one way you can do it:

Create a XML template and store it having unique variable names [ for ones you want to replace the values with ].

Read this template.
Replace the variables with your data.
Append it to original XML.
Done.

Smilie
# 7  
Old 06-08-2009
Quote:
Originally Posted by akil
Hi

Thanks for your replies,This my XML file looks like ,I want to add another 100 lines at end of the file with different CustCodes(1.10000633K,1.10000634K ...) and rest of the columns values are same.
Thanks,
Akil
To add a file to another file you can simply use cat:

Code:
cat file1 file2 > newfile

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Help to join separate lines in a single one from xml file

Hi all, I need help to parse this xml file that has paragraphs broken in different lines and I would like to join in a single line. I hope you can understand my explanation. Thanks for any help/direction. The script could be in bash, awk, ruby, perl whatever please In the output I want:... (8 Replies)
Discussion started by: Ophiuchus
8 Replies

2. Shell Programming and Scripting

Creating multiple xml tag lines in a file

Hi All, Can someone tell me how can we create same xml tag lines based on the number of lines present in other file and replace the Name variable vaule present in other file. basically I have this xml line <typ:RequestKey NameType="RIC" Name="A1" Service="DDA"/> and say I... (4 Replies)
Discussion started by: Optimus81
4 Replies

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

4. Shell Programming and Scripting

To change Specific Lines in An XML file

hi Guys, this is my requirement, there is a huge xml file of this i have to change 3 lines with out opening the file /users/oracle > cat lnxdb-pts-454.xml|egrep "s_virtual|s_cluster|s_dlsnstatus" <cluster_port oa_var="s_clusterServicePort">9998</cluster_port> <host... (2 Replies)
Discussion started by: smarlaku
2 Replies

5. Shell Programming and Scripting

How to add the multiple lines of xml tags before a particular xml tag in a file

Hi All, I'm stuck with adding multiple lines(irrespective of line number) to a file before a particular xml tag. Please help me. <A>testing_Location</A> <value>LA</value> <zone>US</zone> <B>Region</B> <value>Russia</value> <zone>Washington</zone> <C>Country</C>... (0 Replies)
Discussion started by: mjavalkar
0 Replies

6. Shell Programming and Scripting

Extract some lines from one file and add those lines to current file

hi, i have two files. file1.sh echo "unix" echo "linux" file2.sh echo "unix linux forums" now the output i need is $./file2.sh unix linux forums (3 Replies)
Discussion started by: snreddy_gopu
3 Replies

7. Shell Programming and Scripting

Remove lines with non-chinese characters from xml file

Hi there, I'm looking for a way to remove all lines that don't contain chinese characters from an xml file. Example: http://pastebin.com/8KzSbCKe The result should be like this: http://pastebin.com/ZywXsNhx Only lines that don't contain chinese characters should be deleted. If theres a mix of... (3 Replies)
Discussion started by: g4rb4g3
3 Replies

8. Shell Programming and Scripting

Perl XML, find matching condition and grep lines and put the lines somewhere else

Hi, my xml files looks something like this <Instance Name="New York"> <Description></Description> <Instance Name="A"> <Description></Description> <PropertyValue Key="false" Name="Building A" /> </Instance> <Instance Name="B"> ... (4 Replies)
Discussion started by: tententen
4 Replies

9. Shell Programming and Scripting

Commenting xml file lines

Hi , I have a XML file like this <dependency> <groupId>fr.xxxx.portail.ear</groupId> <artifactId>_xxxEAR</artifactId> <version>1.0.0-20xxxxx.xxxxx-x</version> <type>ear</type> </dependency> I need to comment single/multiple lines from XML file. How can i... (6 Replies)
Discussion started by: scorpio
6 Replies

10. Shell Programming and Scripting

Read block of lines from xml file

Hi I am new to this forum. I have few XML files and from each xml file I want to copy some specific 50 no of lines and copy them to some other file. how to do that? pls help.. (5 Replies)
Discussion started by: pritam1980
5 Replies
Login or Register to Ask a Question