Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 1 Jun 2002 18:33:50 -0400
From:      parv <parv@pair.com>
To:        Patrick Thomas <root@utility.clubscholarship.com>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: two ipfw questions...
Message-ID:  <20020601223350.GA20449@moo.holy.cow>
In-Reply-To: <20020531191840.GA52186@moo.holy.cow>
References:  <20020531110825.I18408-100000@utility.clubscholarship.com> <20020531191840.GA52186@moo.holy.cow>

next in thread | previous in thread | raw e-mail | index | archive | help
in message <20020531191840.GA52186@moo.holy.cow>,
wrote parv/pair thusly...
>
> in message <20020531110825.I18408-100000@utility.clubscholarship.com>,
> wrote Patrick Thomas thusly...
...
> > For instance, if you `ipfw show` you get:
> >
> > 00100      7750      1619098 allow udp from any 53 to 10.10.10.10
> >
> > how can I output that to:
> >
> > ipfw add 00100 allow udp from any 53 to 10.10.10.10
> 
> based on your input & output, can be easily done via awk...
> 
> ipfw show | awk ' BEGIN { rule = "ipfw add" }
>                   {
>                      rule = rule" "$1
>                      for (i = 4; i <= NF; i++)
>                      { rule = rule" "$i }
>                   }
>                   END { print rule }'
>

my bad... that's not what you really want, this is...

ipfw show | awk '{ rule = "ipfw add "$1
                   for (i = 4; i <= NF; i++)
                   { rule = rule" "$i }
                   print rule
                 }'

-- 
 

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020601223350.GA20449>