From owner-freebsd-hackers@FreeBSD.ORG Tue Feb 9 21:08:23 2010 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EB903106566C for ; Tue, 9 Feb 2010 21:08:23 +0000 (UTC) (envelope-from brampton@gmail.com) Received: from mail-fx0-f224.google.com (mail-fx0-f224.google.com [209.85.220.224]) by mx1.freebsd.org (Postfix) with ESMTP id 82A788FC17 for ; Tue, 9 Feb 2010 21:08:23 +0000 (UTC) Received: by fxm24 with SMTP id 24so1213983fxm.3 for ; Tue, 09 Feb 2010 13:08:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:received:date :x-google-sender-auth:message-id:subject:from:to:content-type; bh=p9ETipxjKaYUP72QOYr0Z4MVtLkbcTYFs1vEOswUBAM=; b=i88n1R7i6+xSsi1k/GjPW20jRe10h0c5Na8l3mHcEQwYGJrPGEAUOwD1mT4iyFnk9f gIoVWNotufeSBDTYpFux4Mgl+xCz0QsfslWA0fln3fUOCGWX9EPR/aG7mauQufqPJuIj ZzSVOACidkqW7OkZM+dmx2BiJTjNMC+eHSOHo= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:date:x-google-sender-auth:message-id:subject :from:to:content-type; b=grNMN0VFCTFhbkRwd8E66/zgcMr/hiaaZUNGu3lZ7RAU6dKyuuJgWwDW0r0oe/v2NK ZkvjXcjjw5whjyZwU+hSMA3OS4MPTXeSRh9GaHNrihLnRlBdVpXmuGjzBgEVI0BwTlDM RhICXMjwJLV73oL2K9HTAcvN/3dbor2aufT1Y= MIME-Version: 1.0 Sender: brampton@gmail.com Received: by 10.223.94.204 with SMTP id a12mr836368fan.75.1265749702222; Tue, 09 Feb 2010 13:08:22 -0800 (PST) Date: Tue, 9 Feb 2010 21:08:22 +0000 X-Google-Sender-Auth: 75f370ed1dba2acc Message-ID: From: Andrew Brampton To: freebsd-hackers@freebsd.org Content-Type: text/plain; charset=UTF-8 X-Mailman-Approved-At: Tue, 09 Feb 2010 22:29:15 +0000 Subject: sysctl with regex? X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Feb 2010 21:08:24 -0000 Today I was writing a script to read all the dev.cpu.?.temperature sysctl OIDs. I was parsing them using a simple grep, but it occurred to me it might be better if sysctl supported some form of regexp. For example instead of typing: sysctl -a | grep dev.cpu.*.temperature I could write: sysctl dev.cpu.*.temperature which would display all the OIDs that match dev.cpu.*.temperature. This is better than grep because when I issue a "sysctl -a" the program retrieves many variables that I am not interested in (which later get filtered by grep). This would in a way be similar to: sysctl dev.cpu which lists all the OIDs under dev.cpu. Is this a feature people would find useful? Or would I be optimising a problem that doesn't exist? Thanks for any input Andrew