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";
Converting to regexec for C is left as an exercise for the reader :).
-
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/