From owner-freebsd-questions@FreeBSD.ORG Thu Aug 3 22:05:52 2006 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 4FC4116A4DD for ; Thu, 3 Aug 2006 22:05:52 +0000 (UTC) (envelope-from freebsd@hub.org) Received: from hub.org (hub.org [200.46.204.220]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6B21D43D5F for ; Thu, 3 Aug 2006 22:05:46 +0000 (GMT) (envelope-from freebsd@hub.org) Received: from localhost (mx1.hub.org [200.46.208.251]) by hub.org (Postfix) with ESMTP id 3947B291B0D; Thu, 3 Aug 2006 19:05:42 -0300 (ADT) Received: from hub.org ([200.46.204.220]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 72122-06; Thu, 3 Aug 2006 19:05:45 -0300 (ADT) Received: from ganymede.hub.org (blk-224-179-167.eastlink.ca [24.224.179.167]) by hub.org (Postfix) with ESMTP id 31E2B291B0A; Thu, 3 Aug 2006 19:05:41 -0300 (ADT) Received: by ganymede.hub.org (Postfix, from userid 1027) id E18E05C1D0; Thu, 3 Aug 2006 19:05:46 -0300 (ADT) Received: from localhost (localhost [127.0.0.1]) by ganymede.hub.org (Postfix) with ESMTP id DECE05C1C6; Thu, 3 Aug 2006 19:05:46 -0300 (ADT) Date: Thu, 3 Aug 2006 19:05:46 -0300 (ADT) From: User Freebsd To: Philip Hallstrom In-Reply-To: <20060803165843.V98843@bravo.pjkh.com> Message-ID: <20060803190520.S25268@ganymede.hub.org> References: <20060803180553.B6529@ganymede.hub.org> <20060803165843.V98843@bravo.pjkh.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: freebsd-questions@freebsd.org Subject: Re: Stand up and be counted - BSDStats Project 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: Thu, 03 Aug 2006 22:05:52 -0000 Sweet, thanks ... On Thu, 3 Aug 2006, Philip Hallstrom wrote: >> pciconf -lv needs to be parsed, this being the hard step, into a string >> that can be sent via HTTP ... this is the hard part because it has to be >> done as/in a shell script ... anyone out there *really* good at shell >> programming? >> >> What needs to happen is: >> >> pcib4@pci6:0:2: class=0x060400 card=0x00000044 chip=0x032a8086 rev=0x09 >> hdr=0x01 >> vendor = 'Intel Corporation' >> device = '6700PXH PCI Express-to-PCI Express Bridge B' >> class = bridge >> subclass = PCI-PCI >> >> Needs to be converted into: >> >> device=pcib&vendor=Intel+Corporation&device=6700PXH+PCI+Express-to-PCI+Express+Bridge+B&class=bridge&subclass=PCI-PCI >> >> So that the final query would look something like: >> >> fetch http://bsdstats.hub.org/report.php?id=`cat >> /tmp/getid`&device=pcib&vendor=Intel+Corporation&device=6700PXH+PCI+Express-to-PCI+Express+Bridge+B&class=bridge&subclass=PCI-PCI > > This will get you close. Just change the "echo" line... > > ---------------------------------------------------------------------------------------------- > #!/bin/sh > > IFS=" > " > > query_string="" > for line in `pciconf -lv` > do > > echo $line | grep -qs "^[a-z]" > if [ $? -eq 0 ] > then > if [ -n "$query_string" ] > then > echo "http://foo.com/bar.php?"$query_string > query_string="" > fi > else > query_string=$query_string`echo $line | sed -e 's/^ *//' -e 's/ > *=/=/' -e 's/= */=/' -e 's/ $//'`"&" > fi > done > ---------------------------------------------------------------------------------------------- > > _______________________________________________ > freebsd-questions@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-questions > To unsubscribe, send any mail to "freebsd-questions-unsubscribe@freebsd.org" > ---- Marc G. Fournier Hub.Org Networking Services (http://www.hub.org) Email . scrappy@hub.org MSN . scrappy@hub.org Yahoo . yscrappy Skype: hub.org ICQ . 7615664