Going by the man page, I would expect this to work:
ps ah -o pid,pgrp -G 18322
But this shows exactly the same list as without the -G arguments. I want a saner way to produce this output:
ps ah -o pid,pgrp | perl -e 'while(<STDIN>){ my @ws = split " ", $_; if ($ws[1] eq $ARGV[0]) { print $ws[0]."\n" } }' 18322
(Thanks to mst on #perl for the perl-fu)
Here's a more traditional command line version, (thanks againt to mst), but still a bit awkward. $process_group needs to be set beforehand:
ps ah -o pgrp,pid | egrep '^'$process_group' ' | awk '{print $2}'