tweaking and testing how awk handles this, cleared out MHZ from cell cpu speed

This commit is contained in:
inxi-svn 2008-11-04 04:54:49 +00:00
parent 64a9f179e6
commit a3ceadd2e7

9
inxi
View file

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
######################################################################## ########################################################################
#### Script Name: inxi #### Script Name: inxi
#### version: 0.3.16 #### version: 0.3.17
#### Date: November 3 2008 #### Date: November 3 2008
######################################################################## ########################################################################
#### inxi is a fork of infobash, the original bash sys info script by locsmif #### inxi is a fork of infobash, the original bash sys info script by locsmif
@ -769,14 +769,14 @@ get_cpu_data()
IFS=$'\n' IFS=$'\n'
A_CPU_DATA=($(gawk -F': ' ' A_CPU_DATA=($(gawk -F': ' '
{ IGNORECASE=1 }
# TAKE NOTE: \t+ will work for /proc/cpuinfo, but SOME ARBITRARY FILE used for TESTING might contain SPACES! # TAKE NOTE: \t+ will work for /proc/cpuinfo, but SOME ARBITRARY FILE used for TESTING might contain SPACES!
# Therefore PATCH to use [ \t]+ when TESTING! # Therefore PATCH to use [ \t]+ when TESTING!
/^processor\t+:/ { nr = $NF } /^processor\t+:/ { nr = $NF }
/^model name|^cpu\t+:/ { /^model name|^cpu\t+:/ {
modelName = $NF gsub(/,/," ",$NF)
gsub(/,/," ",modelName) cpu[nr, "model"] = $NF
cpu[nr, "model"] = modelName
} }
/^cpu MHz|^clock\t+:/ { /^cpu MHz|^clock\t+:/ {
@ -788,6 +788,7 @@ get_cpu_data()
} }
if ($NF > max) { max = $NF } if ($NF > max) { max = $NF }
gsub(/MHZ/,"",$NF) ## clears out for cell cpu
cpu[nr, "speed"] = $NF cpu[nr, "speed"] = $NF
} }