Sponsored Content
Full Discussion: Insert a newline in XML
Top Forums Shell Programming and Scripting Insert a newline in XML Post 302829545 by anbu23 on Friday 5th of July 2013 07:01:51 AM
Old 07-05-2013
Code:
$ sed "s/^<Message>/\\
&/" file
]]></InputMessage><ErrorMessage><ErrorHeader><ExceptionNumber>2951</ExceptionNumber><TimeStamp>2013-07-03T21:49:10.814803</TimeStamp><BrokerName>WMQPCOM03_BK</BrokerName><BrokerFamily>UNIX</BrokerFamily><ExecutionGroup>WMQPCOM03_TCOM_FULFILLMENT</ExecutionGroup><QueueManager>WMQPCOM03</QueueManager><InputQueue>TCOM.FULFILLMENT.OMS.WMS.SA.SUB</InputQueue><MessageFlow>com.tgt.tcom.il.shipment.TCOM_SA_OMS_WMS_Subscribe_MsgFlow</MessageFlow><MessageId>414d5120574d5150434f4d30332020209371c7515f86dc34</MessageId><ErrorSeverity>3</ErrorSeverity><ErrorCategory>UserException</ErrorCategory><ErrorSource>com.tgt.tcom.il.shipment.TCOM_SA_OMS_WMS_Subscribe_MsgFlow.TCOM_SA_Transform_Batch_SubFlow.Transform_SA_ToFC</ErrorSource></ErrorHeader><ErrorDetails><RecoverableException><File>/build/S700_P/src/DataFlowEngine/ImbComputeNode.cpp</File><Line>489</Line><Function>ImbComputeNode::evaluate</Function><Type>ComIbmComputeNode</Type><Name>com/tgt/tcom/il/shipment/TCOM_SA_OMS_WMS_Subscribe_MsgFlow#FCMComposite_1_1.com/tgt/tcom/il/shipment/TCOM_SA_Transform_Batch_SubFlow#FCMComposite_1_2</Name><Label>com.tgt.tcom.il.shipment.TCOM_SA_OMS_WMS_Subscribe_MsgFlow.TCOM_SA_Transform_Batch_SubFlow.Transform_SA_ToFC</Label><Catalog>BIPmsgs</Catalog><Severity>3</Severity><Number>2230</Number><Text>Caught exception and rethrowing</Text><RecoverableException><File>/build/S700_P/src/DataFlowEngine/ImbRdl/ImbRdlStatementGroup.cpp</File><Line>641</Line><Function>SqlStatementGroup::execute</Function><Type>ComIbmComputeNode</Type><Name>com/tgt/tcom/il/shipment/TCOM_SA_OMS_WMS_Subscribe_MsgFlow#FCMComposite_1_1.com/tgt/tcom/il/shipment/TCOM_SA_Transform_Batch_SubFlow#FCMComposite_1_2</Name><Label>com.tgt.tcom.il.shipment.TCOM_SA_OMS_WMS_Subscribe_MsgFlow.TCOM_SA_Transform_Batch_SubFlow.Transform_SA_ToFC</Label><Catalog>BIPmsgs</Catalog><Severity>3</Severity><Number>2488</Number><Text>Error detected, rethrowing</Text><Insert><Type>5</Type><Text>com.tgt.tcom.il.shipment.Transform_SA_ToFC.Main</Text></Insert><Insert><Type>5</Type><Text>175.4</Text></Insert><Insert><Type>5</Type><Text>THROW EXCEPTION  MESSAGE 2951 VALUES( &apos;Error Message&apos;, &apos;SterlingMessage.OrderRelease.PersonInfoShipTo.FirstNameANDLasteName/Addr1/City/State/Country/ZipCode value is empty or state value&gt;2&apos;);</Text></Insert><UserException><File>/build/S700_P/src/DataFlowEngine/ImbRdl/ImbRdlThrowExceptionStatements.cpp</File><Line>229</Line><Function>SqlThrowExceptionStatement::execute</Function><Type>ComIbmComputeNode</Type><Name>com/tgt/tcom/il/shipment/TCOM_SA_OMS_WMS_Subscribe_MsgFlow#FCMComposite_1_1.com/tgt/tcom/il/shipment/TCOM_SA_Transform_Batch_SubFlow#FCMComposite_1_2</Name><Label>com.tgt.tcom.il.shipment.TCOM_SA_OMS_WMS_Subscribe_MsgFlow.TCOM_SA_Transform_Batch_SubFlow.Transform_SA_ToFC</Label><Catalog>BIPmsgs</Catalog><Severity>1</Severity><Number>2951</Number><Text>User generated exception</Text><Insert><Type>5</Type><Text>Error Message</Text></Insert><Insert><Type>5</Type><Text>SterlingMessage.OrderRelease.PersonInfoShipTo.FirstNameANDLasteName/Addr1/City/State/Country/ZipCode value is empty or state value&gt;2</Text></Insert></UserException></RecoverableException></RecoverableException></ErrorDetails></ErrorMessage></Message>

<Message><InputMessage><![CDATA[<?xml version="1.0"encoding="UTF8"?>

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

use regexp to insert newline within a line

I have successfully used regexp and sed to insert a newline before or after a line containing a matched pattern /WORD/. However, I want to insert a newline immediately following /WORD/ and not after the -line- containing the pattern matched. I can match a pattern, but it is matched via a wild card... (2 Replies)
Discussion started by: kpeirce
2 Replies

2. Shell Programming and Scripting

Insert two newline after some pattern

Hi, I need to insert two newline characters after matching of a pattern in each line of a file. Eg. If i have a file with contents as follows:- Now, i want output as follows :- i.e., I need to insert two newline characters after the occurance of pattern "</Message>>". Thnx... (1 Reply)
Discussion started by: DTechBuddy
1 Replies

3. Shell Programming and Scripting

How to enter a newline after every XML tag end?

Hi Guyz, I have an XML message in following format: I want my contents to be formatted in following order: i.e. I want a newline after every XML tag end. How to do this? Thnx in advance. (5 Replies)
Discussion started by: DTechBuddy
5 Replies

4. Shell Programming and Scripting

AWK Script Issue insert newline for a regular expression match

Hi , I am having an issue with the Awk script to insert newline for a regular expression match Having a file like this FILE1 #################### RXOER , RXERA , RXERC , RXERD .RXEA(RXBSN), RXERD , REXCD input RXEGT buffer RXETRY ####################### Want to match the RXE... (38 Replies)
Discussion started by: jaita
38 Replies

5. Shell Programming and Scripting

sed insert text without newline

Hi, I use sed to insert text at beginning of a file. But sed inserts a newline after my text that I do not need. For example, I want to insert "foo" at the beginning of my file: > cat myfile This is first line. > sed -i '1i\foo' myfile > cat myfile foo This is first line. ... (5 Replies)
Discussion started by: tdw
5 Replies

6. Shell Programming and Scripting

Script using Sed :Search all patterns & after the last Patter, insert a newLine with Comma Sep Value

I am trying to search the pattern "ARS (11)" and after the LAST pattern, i am trying to open new line and enter text using sed. My Existing Text file is Users.txtpaul, Paul Smith, Stevn Smiley, REQ000001, ARS (11) sam, Sam Martin, Stevn Smiley, REQ000001, ARS (11) mike, Mike Conway, Stevn... (8 Replies)
Discussion started by: evrurs
8 Replies

7. Shell Programming and Scripting

Insert new pattern in newline after the nth occurrence of a line pattern - Bash in Ubuntu 12.04

Hi, I am getting crazy after days on looking at it: Bash in Ubuntu 12.04.1 I want to do this: pattern="system /path1/file1 file1" new_pattern=" data /path2/file2 file2" file to edit: data.db - I need to search in the file data.db for the nth occurrence of pattern - pattern must... (14 Replies)
Discussion started by: Phil3759
14 Replies

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

9. Shell Programming and Scripting

Insert newline when grep result is empty

Given a csv file with 40 columns with name, address, hometown etc. I use a bash command in 1 line which: 1. gets the address column and pipes that to 2. grep the first digit and everything that follows Command: awk -F ";" '{print $19}' /Users/jb/Desktop/ReorderTempTotal.csv | grep -o "\d.*"... (7 Replies)
Discussion started by: JBVeenstra
7 Replies

10. Shell Programming and Scripting

Insert a newline after match in files of specific name under some subdirectories?

Hi I'd like to add the newline: \tuser: nobody", or "<TAB>user: nobody to all files named: docker-compose.ymlin subfolders of pwd with names beginning with 10-20. Within these files, I'd like to find the line (there'll only be one) containing: command: celery workerNOTE: As far as... (2 Replies)
Discussion started by: duncanbetts
2 Replies
All times are GMT -4. The time now is 04:03 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy