Date: Wed, 6 Jul 2005 23:29:17 -0400 From: "fbsd_user" <fbsd_user@a1poweruser.com> To: "Alejandro Pulver" <alejandro@varnet.biz> Cc: "freebsd-questions@FreeBSD. ORG" <freebsd-questions@FreeBSD.ORG> Subject: RE: help with she script Message-ID: <MIEPLLIBMLEEABPDBIEGGEFDHIAA.fbsd_user@a1poweruser.com> In-Reply-To: <20050703181722.6d20fe89@phobos.mars.bsd>
next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, 3 Jul 2005 16:47:24 -0400 "fbsd_user" <fbsd_user@a1poweruser.com> wrote: > This is my last coding problem. > > > target="check-state" > > # Find the rule number of the target rule where you want the doorman > # pass rules inserted before. > > ruleno=`ipfw list | sed -n -e "s/00\([0-9]*\) $target/\1/p"` > > The output of 'ipfw list' looks like this > > nnnnn a 5 position sequence rule number > blank followed by a empty single position > x-x a 10 to 80 position rule text 00010 allow ip from any to any via lo0 00015 check-state 00110 allow tcp from any to 68.168.240.26 dst-port 53 out via dc0 setup keep-state 00111 allow udp from any to 68.168.240.26 dst-port 53 out via dc0 keep-state 00120 allow udp from any to any dst-port 67 out via dc0 keep-state 00200 allow tcp from any to any dst-port 80 out via dc0 setup keep-state > > > When the rule text matches the target text I want the > first 5 position rule number to go into ruleno. > > Large rules files may use all 5 positions and then > the above code will fail to get the rule number. > Tried to remove the s/00\ but had syntax problems. > Hello, I do not have ipfw, and I do not know how the rules are supposed to be, and how they have to be processed. Could you please send me some example rules, and the expected output to be assigned to "ruleno"? Thanks and Best Regards, Ale ****************************************************** the expected output to be assigned to "ruleno" is the first 5 positions of the record which is the rule number.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?MIEPLLIBMLEEABPDBIEGGEFDHIAA.fbsd_user>