Re: /proc/cpuinfo consistency

Jauder Ho (jauderho@transmeta.com)
Mon, 21 Sep 1998 01:12:24 -0700 (PDT)


bad boy, always use chomp() :)

--Jauder

On Mon, 21 Sep 1998, Keith Owens wrote:

> regex is your friend. In perl
>
> while (<>) {
> chop();
> $cpu = $2 if (/^cpu( family)?\s*:\s*(\S*)/i);
> $model = $1 if (/^model\s*:\s*(\S*)/i);
> $model_name = $1 if (/^model name\s*:\s*(\S*)/i);
> $bogomips += $1 if (/^bogomips\s*:\s*(\S*)/i);
> }
>
> $cpu = $model_name if($model_name);
> print "cpu=$cpu\n";
> print "bogomips=$bogomips\n";
>

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/