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 -->
  #1 (permalink)  
Old 10-14-2008
tink tink is offline
Registered User
  
 

Join Date: Jun 2008
Posts: 4
Removing end of line to merge multiple lines

I'm sure this will be an easy question for you experts out there, but I have been searching the forum and working on this for a couple hours now and can't get it right.

I have a very messy data file that I am trying to tidy up - one of the issues is some records are split into multiple lines:

999999000 "Name" "this is text for line one
line two
line three"

And I've been trying all sorts of version of sed to get it to look like this:
999999000 "Name" "this is text for line one line two line three"

and yes, I have tried things like sed 's/$/ /' file1 > file2... the problem is not every line has an issue, so I'm trying to figure out how to only remove line feeds for problematic lines, not all lines

the problem lines will begin with alpha characters not numeric, so I've been trying to do something with that but to no avail

thanks

Last edited by tink; 10-14-2008 at 11:17 AM..