Help with sed

Help with sed

Post by Mike Madla » Thu, 03 Aug 1995 04:00:00



I have a text file with correct lines ending with a quote and a
newline. Incorrect lines are split and wrap to the next line, they
just end with a newline.

I want to unwrap those lines, i.e. delete the newline for all lines
that don't end in quote newline.

Can I do this with sed?

 
 
 

Help with sed

Post by netcz » Fri, 04 Aug 1995 04:00:00



Quote:>Can I do this with sed?

Probably at the blink of an eye.

Ravi

 
 
 

Help with sed

Post by Rouben Rostami » Fri, 04 Aug 1995 04:00:00




>I have a text file with correct lines ending with a quote and a
>newline. Incorrect lines are split and wrap to the next line, they
>just end with a newline.

>I want to unwrap those lines, i.e. delete the newline for all lines
>that don't end in quote newline.

>Can I do this with sed?

Make a file, say sed.script, with the following contents;

/[^"]$/ {
N
s/\
//

Quote:}

Then do

sed -f sed.script oldfile > newfile

This assumes that all "incorrect lines" come in pairs.

--