I want to monitor memory usage for several processes and came up with a command like this:
ps aux |grep -e postgres -e unicorn -e nginx|cut -d' ' -f2|for i in $(xargs); do echo $i; done 16112 16113 ... How can I change the bit after the last pipe to feed arguments into top -p $i, so I get an of overall idea of memory consumption for all pids? The final command would produce something like top -p<pid1> -p<pid2> and so on