From owner-freebsd-questions@FreeBSD.ORG Sun Jul 3 21:15:32 2005 Return-Path: X-Original-To: freebsd-questions@FreeBSD.ORG Delivered-To: freebsd-questions@FreeBSD.ORG Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 0E88D16A41C for ; Sun, 3 Jul 2005 21:15:32 +0000 (GMT) (envelope-from alejandro@varnet.biz) Received: from relay.pair.com (relay00.pair.com [209.68.1.20]) by mx1.FreeBSD.org (Postfix) with SMTP id 9F1ED43D4C for ; Sun, 3 Jul 2005 21:15:31 +0000 (GMT) (envelope-from alejandro@varnet.biz) Received: (qmail 28849 invoked from network); 3 Jul 2005 21:15:30 -0000 Received: from unknown (HELO phobos.mars.bsd) (unknown) by unknown with SMTP; 3 Jul 2005 21:15:30 -0000 X-pair-Authenticated: 200.115.214.28 Date: Sun, 3 Jul 2005 18:17:22 -0300 From: Alejandro Pulver To: fbsd_user@a1poweruser.com Message-ID: <20050703181722.6d20fe89@phobos.mars.bsd> In-Reply-To: References: <20050703163319.58bd970c@phobos.mars.bsd> X-Mailer: Sylpheed-Claws 1.0.4 (GTK+ 1.2.10; i386-portbld-freebsd5.4) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: "freebsd-questions@FreeBSD. ORG" Subject: Re: help with she script X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Jul 2005 21:15:32 -0000 On Sun, 3 Jul 2005 16:47:24 -0400 "fbsd_user" wrote: > > Thanks guys your solutions have worked and I am learning allot along > the way. > You are welcome. > 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. > 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