novice sed ?

Stephen Brooks brooks at sundance7.dab.ge.com
Sat May 4 07:35:50 AEST 1991


  I have a sed question for you gurus: assume I have a file of the form

name1; A1.1 B10.20 C100.300,
       D101.25 E202.50,
       F300.7
name2; Z44.33 Y409.45
name3; X777.77 W6.6,
       V32.15

where a comma (,) represents a continuation character.  I need to "massage"
this into something which looks like this:

name1; A1.1 B10.20 C100.300 D101.25 E202.50 F300.7
name2; Z44.33 Y409.45
name3; X777.77 W6.6 V32.15

Can I do this in sed?  I've tried using the N command in sed, but the problem
with it is I don't see how to handle multiple continuation lines without using
multiple N commands.  Is this possible?  What am I missing?

I currently have to do something like this (in sed):
/,$/ N		find "," at end of line, append next line to input pattern
s/\n//		delete embedded <CR>
/,$/ N		do it again (and again and again...)
s/\n//
.
.
.

Thanks!
--
%% Stephen (Steve) M. Brooks       %% brooks at ge-dab.ge.com              %%
%% GE Simulation & Control Systems %% ...!uunet!ge-dab.ge.com!brooks    %%
%% P.O. Box 2825, Rm. 1370         %% ...!uunet!sunny.dab.ge.com!brooks %%
%% Daytona Beach, FL  32115-2825   %% voice: (904) 239-4855             %%



More information about the Comp.unix.questions mailing list