- echo "nr_node: $(echo "$lscpu" | grep "NUMA node(s)" | awk '{print $3}')"
- echo "nr_cpu: $(echo "$lscpu" | grep "^CPU(s)" | awk '{print $2}')"
- echo "arch: $(echo "$lscpu" | grep "Architecture" | awk '{print $2}')"
- echo "model_name: $(echo "$lscpu" | grep "Model name" | awk '{print $3}')"
Please create a common function and call it in each above line. Use awk this way:
% lscpu|awk -F': *' '/Architecture:/{print $2}' x86_64
Thanks, Fengguang