I've written the shell command below to output the CPU's clock speed as an integer:
grep -m 1 'cpu MHz' /proc/cpuinfo | grep -o -E '[0-9]+'
OUTPUT:
900
063
This is because the exact clock speed is 900.063. Essentially, I want the command to return the 900 part but not the part after the decimal (.063).
Any help is much appreciated, thanks.
| head -n 1on the end not acceptable? This will give you the first line of output.