novice sed ?
Rouben Rostamian
rouben at math16.math.umbc.edu
Sat May 4 08:52:02 AEST 1991
In article <1991May3.213550.17246 at ge-dab.GE.COM> brooks at 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' <inputfile
--
Rouben Rostamian Telephone: (301) 455-2458
Department of Mathematics and Statistics e-mail:
University of Maryland Baltimore County bitnet: rostamian at umbc.bitnet
Baltimore, MD 21228, U.S.A. internet: rouben at math9.math.umbc.edu
More information about the Comp.unix.questions
mailing list