Using cut and uniq

For some weird reason I had to do this, cut and uniq turned out to be quite handy and can be used along with sed

cat /proc/cpuinfo | grep "model name" | uniq | cut -d: -f2

So, instead of this
model name : Intel(R) Core(TM)2 Duo CPU E8500 @ 3.16GHz
model name : Intel(R) Core(TM)2 Duo CPU E8500 @ 3.16GHz


I get this
Intel(R) Core(TM)2 Duo CPU E8500 @ 3.16GHz

OK, another approach is to use awk
cat /proc/cpuinfo | grep "model name" | uniq | awk -F: '{print($2)}'

No comments: