Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!udel!haven.umd.edu!umbc3.umbc.edu!math16.math.umbc.edu!rouben From: rouben@math16.math.umbc.edu (Rouben Rostamian) Newsgroups: comp.unix.questions Subject: Re: novice sed ? Message-ID: <1991May3.225202.29639@umbc3.umbc.edu> Date: 3 May 91 22:52:02 GMT References: <1991May3.213550.17246@ge-dab.GE.COM> Sender: newspost@umbc3.umbc.edu (News posting account) Organization: University of Maryland Baltimore County, Mathmatics Department Lines: 35 In article <1991May3.213550.17246@ge-dab.GE.COM> brooks@sundance7.dab.ge.com (Stephen Brooks) writes: > 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? Yes. Here it is: sed -n ' :loop /,$/{N bloop } s/,\n//g s/ */ /g p'