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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using sed to insert a newline

Status
Not open for further replies.

MauryL

Technical User
Jun 20, 2006
1
US
Hi,

I'm sort of a newbie, and I have these long xml files to deal with. For clarity's sake, I want to add a newline at the end of each element.

So I want to replace /> with />newline. (With "newline" being an actual newline, not the word.)

I'm using the sed on Mac OSX's UNIX, not the apparently more helpful gnu sed. so \n doesn't mean newline here.

Best wishes,
Laurel
 
This works with Solaris' sed:

Code:
 sed 's,/>,/>\
> ,g' /tmp/testfile

Annihilannic.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top