Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I add in a CR between two characters 3

Status
Not open for further replies.

jdespres

MIS
Aug 4, 1999
230
0
0
US
I have a line of data thats pretty long...

I would like to break this data up ...

I would like to insert a carriage return line feed between the following two characters

><

This will make looking at the data a bit better!

Thanks...

Joe Despres
 
What about the gsub function ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Used tr instead ::--->

tr '><' '>\n'

Thanks....

Joe Despres
 
Hi

Joe said:
tr '><' '>\n'
As [tt]tr[/tt] does transliteration, so your command :
[ul]
[li]replaces all > with >[/li]
[li]replaces all < with \n[/li]
[/ul]
That means the first character of both parameters is pointless here.


Feherke.
 
He's just pointing out that the results would be identical with:

Code:
tr '<' '\n'

I presume it doesn't matter that you are removing some "<" characters in the process?

Annihilannic
[small]tgmlify - code syntax highlighting for your tek-tips posts[/small]
 
Hi

Try with this small awk command:

awk '{gsub ("><",">\012<") ; print}' your_file

Good Day

Eric
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top