Jim you could use your grep command then use cut with a delimiter of: like -d":" and pick the fields you need with -f cat /etc/groups|grep mail| cut -d ":" -f2 some permutation of that