sed -e :a -e '/&$/N; s/&\n/\&/; ta' < oldfile > newfile
-jdr-
PAUL TRACESKI wrote:
>
> I have been unsuccessful for the past couple of days
> in finding a way to use the sed command to combine lines
> in a file. I have a series of lines as follows:
>
> 0382 ABCD &
> TRCD &
> UTNB
> 9456 YRFD
> 8345 YSSW &
> LOPI
> 3384 QAIK &
> NBVC &
> POIJ &
> TDDC
>
> I would like to take lines that end in & and somehow eliminate
> the new line feed so that I will end up with something like:
>
> 0382 ABCD &TRCD &UTNB
> 9456 YRFD
> 8345 YSSW &LOPI
> 3384 QAIK &NBVC &POIJ &TDDC
>
> The solution must use a stream editing command or something
> comparable. Any ideas?
> Paul Traceski
> [EMAIL PROTECTED]
-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to [EMAIL PROTECTED]
Please read the FAQ at http://www.linux-learn.org/faqs