Linux Learnings

dave@mule:~$ arr=($(ipcs -p | awk -F ' *' '$3 ~ /^[0-9]+$/ {print $3}' ))
dave@mule:~$ for i in "${arr[@]}"; do :; ps aux | grep -v grep | grep -e $i; done

This code firstly creates an array of the 3rd column’s numerical values from the [ ipcs-p ] command and then in the second command it iterates over the array and filters out the [ps aux] results using [grep] to display only entries matching the item in the array.

It’s not terribly efficient but I’m just starting out here… 🙂



Leave a Reply

Your email address will not be published. Required fields are marked *