Stand up and be counted - BSDStats Project

User Freebsd freebsd at hub.org
Thu Aug 3 22:05:52 UTC 2006


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 at 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 at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to "freebsd-questions-unsubscribe at freebsd.org"
>

----
Marc G. Fournier           Hub.Org Networking Services (http://www.hub.org)
Email . scrappy at hub.org                              MSN . scrappy at hub.org
Yahoo . yscrappy               Skype: hub.org        ICQ . 7615664


More information about the freebsd-questions mailing list