My goal is to find a process that consumes most CPU and RAM by writing a script. However, I managed to extract information from the TOP command, but I had problems parsing the output.
Next command
top -b -n 1 | tail -n +8 | head -n 1
Print something similar to this single line,
915 root 20 0 209m 74m 8644 S 8 7.7 5:27.57 Xorg
I want this line of text to be a list of arguments for my script. I understand that I need to read it from STDIN, but I want to read the above output word by word or argument by argument, as if it were specified from the command line.
echo " Parameter is ${2} ${3}"
source
share