I have command to list system process by memory usage:

ps -A --sort -rss -o comm,pmem


Which list a table like

COMMAND         %MEM
firefox         28.2
chrome           5.4
compiz           4.8
atom             2.5
chrome           2.3
Xorg             2.3
skype            2.2
chrome           2.0
chrome           1.9
atom             1.9
nautilus         1.8
hud-service      1.5
evince           1.3


I would like to get total memory share per programs instead of per process of same programs. So I could get output like

COMMAND         %MEM
firefox         28.2
chrome          11.6
compiz           4.8
atom             4.4
Xorg             2.3
skype            2.2
nautilus         1.8
hud-service      1.5
evince           1.3


I thought about using awk, which I don't know much. Ended up with something like:

ps -A --sort -rss -o comm,pmem | awk -F "\t" '
{processes[$0] += $1;}
{End
for(i in processes) {
  print i,"\t",processes[i];
}
}'


But it didn't work.

How can I correct this?


Question: Does the original jutsu user feel anything when a shadow clone is dispersed forcefully?
Answer: Well, actually the mental stress involved when a clone is forcefully destroyed being transferred to the original has been showed on a number of occasions in the anime, including once before the timeskip.

During the Invasion of Konoha arc:


   When Naruto fights Gaara, Gaara goes into the Ichibi Shukaku mode, and Naruto attacks Gaara/Shukaku using 1000 clones with the Naruto Niisen Rendan (Naruto Two Thousand Combo). He then attempts the Naruto Yonsen Rendan (Naruto Four Thousand Combo), but Shukaku fights back and destroys nearly all the clones. As Naruto is forced back, he exclaims, "That hurt a lot".


Later after the timeskip, when Kakashi tells Naruto that the pain experienced by the clone is transferred to the user, Naruto says in a dejected/annoyed tone, "I knew that already."