The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

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




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #3 (permalink)  
Old 10-09-2008
Franklin52 Franklin52 is offline Forum Staff  
Moderator
  
 

Join Date: Feb 2007
Posts: 4,212
Another one, if the last character of the line isn't a ">", add the next line into the contents of the pattern space and delete the newline character:

Code:
sed -n '/[^>]/$/N;s/\n//p' file
With awk, if the last character of the line isn't a ">" print the line without a newline:

Code:
awk '!/>$/{printf("%s",$0);next}1' file
Regards

Last edited by Franklin52; 10-09-2008 at 01:24 PM.. Reason: adding comments