The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
sed ksh remove newline between 2 containers JamesJSC Shell Programming and Scripting 3 12-19-2008 04:54 AM
how to remove all tabs and newline (\n) pvr_satya Shell Programming and Scripting 2 08-16-2008 03:38 PM
grep the pattern followed by newline lalelle Shell Programming and Scripting 2 08-21-2007 09:02 PM
remove trailing newline characters shweta_d Shell Programming and Scripting 7 06-05-2007 10:29 AM
grep and sed to find a pattern and add newline ssikhar Shell Programming and Scripting 5 10-26-2004 06:32 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 01-02-2009
nico.ben nico.ben is offline
Registered User
  
 

Join Date: Jan 2009
Posts: 1
SED: how to remove newline after pattern?

Hi,
I have the following XML not well-indented code:

<hallo
>this is a line
</hallo>

So I need to remove the newline.

This syntax finds what I need to correct, but I don't know how to remove the newline after my pattern:

sed 's/<.*[^>]$/&/'

How can I subtract the newline after my pattern, please?

Thank you in advance,
Nico
  #2 (permalink)  
Old 01-02-2009
reborg's Avatar
reborg reborg is offline Forum Staff  
Administrator
  
 

Join Date: Mar 2005
Location: Ireland
Posts: 4,245
I'm not sure which format you want, but one of these should do what you are looking for:

Code:
sed -e '/<[^>][^>]*/N' -e 's/\n>/>\n/'


Code:
sed -e '/<[^>][^>]*/N' -e 's/\n//'

Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 07:42 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0