I got requirement to get the top CPU utilizing processes in machines in the infrastructure. I was able to achieve this by listing down all the processes with thier CPU utilization percentage along with some more details as given below
CPU% PID USERNAME PROCESSNAME
21% 484 SYSTEM svchost.exe
0% 1116 SYSTEM svchost.exe
0% 1260 SYSTEM snac64.exe
0% 1844 NETWORK SERVICE CdfSvc.exe
0% 1900 SYSTEM cdfre.exe
0% 1956 LOCAL SERVICE CAudioService.exe
0% 2336 LOCAL SERVICE svchost.exe
2% 2376 LOCAL SERVICE pidSvc.exe
0% 2528 LOCAL SERVICE svchost.exe
0% 2560 SYSTEM ccSvcHst.exe
0% 2816 SYSTEM sftvsa.exe
0% 2952 SYSTEM Shopping.exe
0% 3240 NETWORK SERVICE WorksAgent.exe
0% 3344 LOCAL SERVICE encsvc.exe
0% 3388 LOCAL SERVICE USB.exe
3% 3564 NETWORK SERVICE WmvSE.exe
And I have put this output in a file such that this file can be sorted based on the first column i.e CPU%
Is there a built in function for sorting? Or else any other way to achieve this.