replace >< with > newline <


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting replace >< with > newline <
# 1  
Old 06-01-2010
replace >< with > newline <

Hi All,
I have the command in PERL for performing this, but Can you please suggest me how can i perform this using AWK:

My input xml file looks like this:
Code:
<aaa>hello</aaa><bbb>hai</bbb>

I want the output like this ( means need new line after end of each xml tag):
Code:
<aaa>hello</aaa>
<bbb>hai</bbb>

Thanks in Advance,

Last edited by Franklin52; 06-01-2010 at 08:44 AM.. Reason: Please use code tags!
# 2  
Old 06-01-2010
Code:
# echo "<aaa>hello</aaa><bbb>hai</bbb>" | awk 'gsub("><",">\n<")'
<aaa>hello</aaa>
<bbb>hai</bbb>
#

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Command to replace newline with comma

Hi Experts, I need an urgent help in replacing newline characters in my single column file by a comma. I am using following command for this purpose: sed -n -e 'H;${x;s/\n/,/g;s/^,//;p;}' parameter.rtf | rev | cut -c 4- | revMy input file has: TABLE_1 TABLE_2 TABLE_3 What I need:... (11 Replies)
Discussion started by: neerndg123
11 Replies

2. Shell Programming and Scripting

Replace newline in a string

I have a string like below: {\rtf1\fbidis\ansi\deff0{\fonttbl{\f0\fnil\fcharset0 MS Sans Serif;}{\f1\fnil MS Sans Serif;}} \viewkind4\uc1\pard\ltrpar\lang2057\f0\fs16 19/11/2010 SOME DESCRIPTION. \par \lang1033\f1\par } I have to replace the newline character with null in the... (8 Replies)
Discussion started by: Pratik4891
8 Replies

3. Shell Programming and Scripting

Replace String With Newline

Hi, I'm struggling with a string replacement. I have an XML file which is in the following layout <FUNCTION> <PRODUCTS> <PRODUCT CODE="PRODUCE" ACTION="amend" VALIDATE="no"> <SUPPLIER PRODUCT="PRODUCT" ACTION="amend" CODE="SUPPLIER"> <STOCK_QUANTITY DATA="21"/> ... (15 Replies)
Discussion started by: Ste_Moore01
15 Replies

4. Shell Programming and Scripting

replace newline between strings

I'm trying to figure out a way to replace newlines after a unique string is read, all the way until that string occurs again. The input file looks something like this: 02/11/11 22:48:00 This is the first line This is the second line This is the third line 02/11/11 22:49:00 This is the... (8 Replies)
Discussion started by: acruhl
8 Replies

5. Shell Programming and Scripting

Replace newline with comma.

I have output from a file like this: 15,01,11,14:06 235 I would like to change this to: 15,01,11,14:06,235 Removing newline and change to "," I now this can be done with tr cat OUT | tr '\n' ','' My problem is that tr is not implemented in this shell. sed is, show it should be... (7 Replies)
Discussion started by: Jotne
7 Replies

6. Shell Programming and Scripting

Replace a string with newline

Hi all I have the problem to substitute a string with newline in Perl. Can anybody help me? And also how to replace a string with opening bracket (e.g. (START ) with a whitespace/null character? Thanks in advance. (1 Reply)
Discussion started by: my_Perl
1 Replies

7. UNIX for Dummies Questions & Answers

how to replace a text with a newline

Hi. How to replace a text in a file with starting from a newline example==== shashi how r u ? shashi , r u their? shashi.... shashi hello shashi output will be shashi how r u ? shashi , r u their? shashi.... shashi hello shashi ========= thanks in advance.. (3 Replies)
Discussion started by: hegdeshashi
3 Replies

8. Shell Programming and Scripting

Replace comma with newline

Hi, for some reason I cant seem to figure this out. I have a file which looks something like this word word word word word,word,word word word word,word,word,word,word word word Basically I want this whole thing to be a list with 1 word on each line like this... word word word... (1 Reply)
Discussion started by: eltinator
1 Replies

9. Shell Programming and Scripting

replace a newline (\n)

dear all: maybe i have a file like : 12 34 56 78 end how do write can i replace newline into NA : make the file inte : 12 NA 34 NA 56 78 END (3 Replies)
Discussion started by: jeter
3 Replies

10. UNIX for Dummies Questions & Answers

How can I replace newline character?

Hi, I am trying to write a script to prepare some text for use as web content. What is happening is that all the newlines in the textfile are ignored, so I want to be able to replace/add a few characters so that for a file containg: This is line 1. This is line two. This is line four.... (1 Reply)
Discussion started by: ghoti
1 Replies
Login or Register to Ask a Question