lst=`ps -e -o pid | grep -v PID` for pid in $lst do port=`pfiles $pid 2>/dev/null| grep "port:" | awk '{print $2"_"$3"_"$5";"}'` if [ "$port" ] then name=`ps -o fname -p $pid | grep -v COMMAND`;args=`ps -o args -p $pid | grep -v COMMAND` echo $name";"$args";"$port fi done