Date: Sun, 3 Jul 2005 16:47:24 -0400 From: "fbsd_user" <fbsd_user@a1poweruser.com> To: "freebsd-questions@FreeBSD. ORG" <freebsd-questions@FreeBSD.ORG> Subject: RE: help with she script Message-ID: <MIEPLLIBMLEEABPDBIEGKEBOHIAA.fbsd_user@a1poweruser.com> In-Reply-To: <20050703163319.58bd970c@phobos.mars.bsd>
next in thread | previous in thread | raw e-mail | index | archive | help
Thanks guys your solutions have worked and I am learning allot along the way. 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 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.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?MIEPLLIBMLEEABPDBIEGKEBOHIAA.fbsd_user>