RE: little awk question

"Yuval Ben-Ari" <[email protected]> Sun, 30 Jul 2006 16:35:43 +0200
Newsgroups gmane.network.toolmakers
Message-ID <58D14E53A4F69C4EAF4D29171C447CC491FA9D@NTX-CL.forest.netvision.net.il>
Thanks!
more or less I made the same changes, I will see if I am missing
something and add.
I will send the diffs to Joe once done.

Yuval

> -----Original Message-----
> From: Jon Ruano [mailto:[email protected]]=20
> Sent: Sunday, July 30, 2006 3:26 PM
> To: Yuval Ben-Ari
> Cc: [email protected]
> Subject: Re: little awk question
>=20
>=20
> Hey, your solution is *way* more elegant.
>=20
> Regarding my changes to the main file, most of them are related to =20
> route-map and distribute-list, and some for snmp-server and ntp lines.
>=20
> These are the ones not explicitely route-map related (some of these =20
> could be grouped too):
>=20
> # ruanoj: found a route-map reference (unsuppress-map)
> /^ neighbor [a-z0-9\.-]+ unsuppress-map / {
>    ref[router " route-map " $4] =3D 1;
>    next;
> }
>=20
> # ruanoj: found a route-map in aggregation
> # aggregate-address a.a.a.a b.b.b.b summary-only attribute-map =20
> routemap001
> /^ aggregate-address [0-9.]+ [0-9.]+ summary-only attribute-map / {
>    ref[router " route-map " $6] =3D 1;
>    next;
> }
>=20
> # ruanoj distribute-list prefix reference into router
> /^ distribute-list prefix / {
>    ref[router " prefix-list " $3] =3D 1;
>    next;
> }
>=20
> # ruanoj distribute-list (simple) reference
> /^ distribute-list / {
>    ref[router " access-list " $2] =3D 1;
>    next;
> }
>=20
> # ruanoj
> #snmp-server community mycommunity view saveconfig RW 61
> /^snmp-server community [a-z0-9\.-]+ view [a-z0-9\.-]+ R. / {
>    ref[router " access-list " $7] =3D 1;
>    next;
> }
>=20
> # ruanoj
> #snmp-server community mycommunity RO 7
> /^snmp-server community [a-z0-9-]+ R. / {
>    ref[router " access-list " $5] =3D 1;
>    next;
> }
>=20
> # ruanoj
> # ntp access-group peer
> /^ntp access-group peer / {
>    ref[router " access-list " $4] =3D 1;
>    next;
> }
>=20
>=20
> # ruanoj: found a community-list reference
> /^ match community / {
>    cur =3D 3;
>    while ( cur <=3D NF ) {
>       ref[router " community-list " $cur] =3D 1;
>       cur++;
>    }
>    next;
> }
>=20
>=20
> On Jul 30, 2006, at 4:10 PM, Yuval Ben-Ari wrote:
> >
> > Yes, that should work.
> > I think I found another way:
> >
> > /^ .* route-map / {
> >   match($0, /route-map ([A-Za-z0-9_\-]+)/, arr);
> >   ref[router " route-map " arr[1]] =3D 1;
> >   next;
> > }
> >
> > P.S
> > It is a shame that we will each do the same work on his own.
> > Did you do many changes in filter_audit.awk file ?
> > I plan to finish my changes and send to the author so it can be
> > published as newer version.
> > I also try to be as reliable to the original as possible.
> >
> > Yuval
> >
>=20
>=20