Sponsored Content
Top Forums Shell Programming and Scripting Removing LF from specific line in XML Post 302987571 by karumudi7 on Monday 12th of December 2016 11:23:02 PM
Old 12-13-2016
Question Removing LF from specific line in XML

Hello Guys,

I have an XML file with below sample (just one data record is given below), I am getting LF characters as mentioned in below specific lines. I need to remove those. When I tried, it is removing from complete file instead of those two specific lines.

And to add one LF after one line for each xml record.

Input :

Code:

<AMS_DOC_XML_IMPORT_FILE>
<AMS_DOCUMENT DOC_CAT="ABC” DOC_TYP=“ABC” DOC_CD=“xxxx” LF (i am getting LF here)
 DOC_DEPT_CD="4" DOC_UNIT_CD="X" DOC_ID=“yyy” LF (I am getting LF here)
 DOC_VERS_NO="1" AUTO_DOC_NUM="false" DOC_IMPORT_MODE="O">LF
 <ABS_DOC_HDR AMSDataObject=“x”>LF
<DOC_CAT Attribute=“x”><![CDATA[ABS]]></DOC_CAT>LF
<DOC_TYP Attribute=“zz”><![CDATA[ABS]]></DOC_TYP>LF
<DOC_CD Attribute=“bb”><![CDATA[GAX9N]]></DOC_CD>LF

Output :
Code:
<AMS_DOC_XML_IMPORT_FILE>LF
<AMS_DOCUMENT DOC_CAT="ABC” DOC_TYP=“ABC” DOC_CD=“xxxx” LF DOC_DEPT_CD="4" DOC_UNIT_CD="X" DOC_ID=“yyy” DOC_VERS_NO="1" 
AUTO_DOC_NUM="false" DOC_IMPORT_MODE="O">LF
<ABS_DOC_HDR AMSDataObject=“x”>LF
<DOC_CAT Attribute=“x”><![CDATA[ABS]]></DOC_CAT>LF
<DOC_TYP Attribute=“zz”><![CDATA[ABS]]></DOC_TYP>LF
<DOC_CD Attribute=“bb”><![CDATA[GAX9N]]></DOC_CD>LF


Thanks in advance.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Removing leading and trailing spaces of data between the tags in xml.

I am having xml document as below. <transactionid> 00 </transactionid> <tracknumber> 0 </tracknumber> <key> N/A </key> But the data contains leading and trailing spaces between the tags. Please let me know how can i remove these leading and trailing spaces between the tags.... (2 Replies)
Discussion started by: jhmr7
2 Replies

2. UNIX for Dummies Questions & Answers

Removing spaces between XML tags<XX XX> -> <XXXX>

hey guys, i have an XML like this: <documents> <document> <Object ID>100114699999</Object ID> <Object Create Date Time>2008-04-07T00:00:00</Object Create Date Time> </document> <documents> I need all my tags within the XML to not include any spaces. i.e. everything between <t a g> in... (8 Replies)
Discussion started by: sharoff
8 Replies

3. Shell Programming and Scripting

Removing specific lines

Hi I have a .conf file having many location tags like <Location /main> AuthName main AuthUserFile /ppt/gaea/passwd_main Require user admin </Location> ...... ... <Location /wonder> AuthName gaea AuthUserFile /ppt/gaea/passwd_gaea Require... (3 Replies)
Discussion started by: catgovind
3 Replies

4. Shell Programming and Scripting

Help in removing xml tags

Hi, I have a input xml file like this <postalAddress:>379 PROSPECT ST </postalAddress:> <street:>STE B </street:> <l:>TORRINGTON </l:> <st:>CT</st:> <postalCode:>067905238</postalCode:>... (5 Replies)
Discussion started by: pintoo
5 Replies

5. Shell Programming and Scripting

awk removing specific line

Hi, I have file with lines key=val. For ex(conf.file):- c=3 ef=78 b=40 ca=40 I want to remove the line with c=3, when I execute the below command it's removing both lines i.e c=3 and ca=40. Could you please correct my command. /usr/xpg4/bin/awk -v key=c 'match($0,key)... (3 Replies)
Discussion started by: axes
3 Replies

6. Shell Programming and Scripting

Using awk to read a specific line and a specific field on that line.

Say the input was as follows: Brat 20 x 1000 32rf Pour 15 p 1621 05pr Dart 10 z 1111 22xx My program prompts for an input, what I want is to use the input to locate a specific field. Like if I type in, "Pou" then it would return "Pour" and just "Pour" I currently have this line but it is... (6 Replies)
Discussion started by: Bungkai
6 Replies

7. Shell Programming and Scripting

Removing unwanted tags from xml file

I have a XML file given as below: "<ProductUOMAlternativeDetails> <removetag> <UOMCode>EA</UOMCode> <numeratorForConversionToBaseUOM>1</numeratorForConversionToBaseUOM> <denominatorForConversionToBaseUOM>1</denominatorForConversionToBaseUOM> <length>0.59</length> <width>0.96</width> ... (3 Replies)
Discussion started by: vikingh
3 Replies

8. Shell Programming and Scripting

Removing last character of a specific line from a file

Hello guys, I would need to remove the last character ")" of a specific line. This can be from any line. Your help is appreciated. Below is the line. HOSTNAME=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)) Please help. (6 Replies)
Discussion started by: sang8g
6 Replies

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

10. 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::LibXML::Comment(3) 				User Contributed Perl Documentation				   XML::LibXML::Comment(3)

NAME
XML::LibXML::Comment - XML::LibXML Comment Class SYNOPSIS
use XML::LibXML; # Only methods specific to Comment nodes are listed here, # see XML::LibXML::Node manpage for other methods $node = XML::LibXML::Comment->new( $content ); DESCRIPTION
This class provides all functions of XML::LibXML::Text, but for comment nodes. This can be done, since only the output of the node types is different, but not the data structure. :-) METHODS
The class inherits from XML::LibXML::Node. The documentation for Inherited methods is not listed here. Many functions listed here are extensively documented in the DOM Level 3 specification (<http://www.w3.org/TR/DOM-Level-3-Core/>). Please refer to the specification for extensive documentation. new $node = XML::LibXML::Comment->new( $content ); The constructor is the only provided function for this package. It is required, because libxml2 treats text nodes and comment nodes slightly differently. AUTHORS
Matt Sergeant, Christian Glahn, Petr Pajas VERSION
2.0018 COPYRIGHT
2001-2007, AxKit.com Ltd. 2002-2006, Christian Glahn. 2006-2009, Petr Pajas. perl v5.16.3 2013-05-13 XML::LibXML::Comment(3)
All times are GMT -4. The time now is 02:32 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy