Sponsored Content
Top Forums Shell Programming and Scripting Insert a new subnode in a xml file Post 302746049 by DGPickett on Tuesday 18th of December 2012 04:54:03 PM
Old 12-18-2012
Well, it made a mess of it! You have two of the original, probably one from the file and one from $val, and some <> ! XML is not that hard to edit by hand, if you know what you want to add. I recommend indenting and linefeeds to make the structure easy to see.

Last edited by DGPickett; 12-18-2012 at 05:59 PM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

script to run shell command and insert results to existing xml file

Hi. Thanks for any help with this. I'm not new to programming but I am new to shell programming. I need a script that will 1. execute 'df -k' and return the volume names with specific text 2. surround each line of the above results in opening and closing xml tags 3. insert the results of step... (5 Replies)
Discussion started by: littlejon
5 Replies

2. Shell Programming and Scripting

Insert value of env variable in xml file

Hello, I have the following variables set in my env echo $MY_XSD_FILE /home/jak/sample.xsd echo $MY_INTERVAL_VALUE 4 I want to insert them between the xml tags in my xml file cat sample.xml ::::::::::::::: ::::::::::::::: <property name="FILE"></property> :::::::::::::::::::::::... (2 Replies)
Discussion started by: jakSun8
2 Replies

3. Shell Programming and Scripting

Insert a new line between the XML tags?.

<TestLog> <TriggerAPI> <StartDate>Nov 16, 2012 6:34:02 AM com.satttest01.Response() </StartDate> <RequestType>SUCCESS: Send :</RequestType> <TranNumber>5210203</TranNumber> <TranId>8585319731207148</TranId> </TriggerAPI> <TriggerAPI> <StartDate>Nov 16, 2012 6:34:02 AM... (3 Replies)
Discussion started by: laknar
3 Replies

4. Shell Programming and Scripting

From sql Insert Query to XML format

Hi How do I translate Let say Cat inserts.sql gives Insert into PM9_TAXATION_ROUNDING (STATE_GECODE, TAX_TYPE, TAX_AUTHORITY, SYS_CREATION_DATE, SYS_UPDATE_DATE, APPLICATION_ID, DL_SERVICE_CODE, ROUNDING_METHOD) Values ('xx', 'xx', 'x', TO_DATE('10/26/2012 13:01:20',... (3 Replies)
Discussion started by: anuj87in
3 Replies

5. Shell Programming and Scripting

Insert a newline in XML

Hi guys, I got a requirement that ... (5 Replies)
Discussion started by: mohanalakshmi
5 Replies

6. Shell Programming and Scripting

awk command to insert a tag in XML

Hi All, I need a help on inserting a XML tag. Actual input <var> <nam>abcd</nam> <a1>.</a1> </var> if tag <a1>.</a1> is getting missed in XML like below <var> <nam>abcd</nam> </var> i need to insert wherever it is missed after <nam> tag and before </var> tag. Could anyone... (3 Replies)
Discussion started by: mohanalakshmi
3 Replies

7. Shell Programming and Scripting

How to insert new line in xml?

I have an xml like below and wanted to insert a new line between end of the tag and start of the new tag. <partyaddress><addressline1>gandhi stree</addressline1><city>hyderbad</city><state>AP</state><addressline1>xyz stree</addressline1><city>bangalore</city><state>Karnataka</state>... (6 Replies)
Discussion started by: D_Sethi
6 Replies

8. Shell Programming and Scripting

Insert text after match in XML file

Having a little trouble getting this to work just right. I have xml files that i want to split some data. I have 2 <name> tags within the file I would like to take only the first tag and split the data. tag example. From this. TAB<Name>smith, john</Name> to TAB<Name>smith,... (8 Replies)
Discussion started by: whegra
8 Replies

9. Shell Programming and Scripting

How to insert a CSV within xml element tag using Python?

Hi Team, I have a CSV file which I have to read through and needs to insert the content within an XML file using Python ONLY ( as most of the code base we have in python only). I managed to find the first part, missing how to insert to XML under "specific" tags. cat input.csv... (0 Replies)
Discussion started by: panyam
0 Replies

10. UNIX for Beginners Questions & Answers

How to insert subnode in xml file using xmlstarlet or any other bash command?

I have multiple xml files where i want to update a subnode if the subnode project points to different project or insert a subnode if it doesn't exist using a xmlstarlet or any other command that can be used in a bash script. I have been able to update the subnode project if it doesn't point to... (1 Reply)
Discussion started by: Sekhar419
1 Replies
UNBLOCK_DEM(1)						      General Commands Manual						    UNBLOCK_DEM(1)

NAME
unblock_dem - Insert linefeeds into a Digital Elevation Model (DEM) file SYNOPSIS
unblock_dem [-L] DESCRIPTION
The drawmap program processes USGS Digital Elevation Model (DEM) files (along with other types of files) to produce customized maps. Drawmap is able to read these files in their native format. However, since the files usually don't contain any linefeeds, they are diffi- cult for a human to read. Unblock_dem filters a DEM file and inserts linefeeds for human readability. It takes input from the standard input and writes to the standard output. The input data must be in uncompressed form, not in gzip-compressed form. Also, unblock_dem does not work with SDTS DEM files or GTOPO30 files. Unblock_dem normally takes no options, but, if you use the "-L" option, the program will print out some license information and exit. Some DEM files already have embedded linefeeds. Unblock_dem makes a feeble attempt to detect these files and abort. If the detection fails, the results are likely to be garbled, so it is wise to check the format of each file first. The drawmap program, with the "-i" option, will attempt to tell you whether a file contains linefeeds or not. The intended use of unblock_dem is simply to let you conveniently examine the files to see what is in them. However, if you are in the mood for adventure, or if you need to repair a defective file, you can use unblock_dem to make the file easy to edit, then you can edit the file as desired. Drawmap can still process the files after linefeeds are inserted, but will become confused if any line (including the linefeed) is more than 1024 characters long. Drawmap may also become confused if you make any significant changes to the format of the file. You may be able to use this capability to repair faulty data. However, you need to be familiar with the content and structure of DEM files in order to do this effectively. You also need to remember that drawmap depends on DEM files having a predictable structure, and it won't properly parse files that violate this predictability. Do this sort of thing only if you know what you are doing, or if you have a lot of free time on your hands. It should be noted that you can obtain a similar effect by using the command recommended by the USGS: dd if=inputfilename of=outputfilename ibs=4096 cbs=1024 conv=unblock I prefer the unblock_dem command because it simply replaces the last byte of each record with a linefeed. This lets me easily tell how long the original records were. The effect of unblock_dem or dd can be undone by typing: dd if=inputfilename of=outputfilename ibs=4096 cbs=1024 conv=block You may come across files that have a linefeed in the 1025th byte. Drawmap doesn't like these, both because it can't tell (within the space of the first 1024-byte record) whether the file contains linefeeds or not, and because the records exceed the maximum record length of 1024 bytes. You may be able to repair such files by blocking them with the above dd command. SEE ALSO
unblock_dlg(1), drawmap(1) Jul 24, 2001 UNBLOCK_DEM(1)
All times are GMT -4. The time now is 07:50 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy