rm cpu.txt echo " CPU" top -l 2 | awk '/CPU usage/ && NR > 5 {print "", $8, $9="user","\n",$10, $11="sys","\n",$12, $13}' > cpu.txt cat cpu.txt