From mboxrd@z Thu Jan 1 00:00:00 1970 MIME-Version: 1.0 In-Reply-To: <4f538c0e46da2504838ea771312e7c74@quanstro.net> References: <4f538c0e46da2504838ea771312e7c74@quanstro.net> Date: Thu, 17 Sep 2009 23:09:50 +0200 Message-ID: From: Rudolf Sykora To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Subject: Re: [9fans] awk help; not plan9 matter Topicbox-Message-UUID: 719caffa-ead5-11e9-9d60-3106f5b1d025 2009/9/17 erik quanstrom : > i don't think you need an extra () for the leading > white space. =A0just tack it on in with the leading expression. see below > the hoc is unnecessary. =A0just start with 2. true :) > fn buildre { > =A0 =A0 =A0 =A0re =3D 's:^([ =A0 =A0 ]*' > =A0 =A0 =A0 =A0for(i in `{seq 2 $1}) > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0re =3D $re ^ '[^ =A0]+[ =A0 =A0 ]+' > =A0 =A0 =A0 =A0re =3D $re ^ ')([^ =A0 =A0 =A0 =A0]+):\1' ^ $2: > } > > ; buildre 1 hell > ; whatis re > re=3D's:^([ =A0 =A0 =A0 ]*)([^ =A0]+):\1hell:' already here is a problem: 1) I am to save the leading space --- so it shouldn't be an argument to s. 2) only the 2nd () --- the word with no spaces in itself --- is to be chang= ed ... since the spaces are to be preserved, none of them should be an argument to the s command, I think. That's why it was treated seperately by me. Anyway, what do you think about that problem with the empty group? Why linux is ok with it while plan 9 is not? Is there any reason? Is that a bug in plan9 sed? Thanks Ruda > ; buildre 2 hell > ; whatis re > re=3D's:^([ =A0 =A0 =A0 ]*[^ =A0 =A0]+[ =A0 =A0 ]+)([^ =A0]+):\1hell:' > > - erik > >