amacks, I found your post very helpful. I modified your script somewhat because there were a couple things that didn't work quite right yet. One I saw problem with RHEL 5.5 and another with RHEL 6.1.
For RHEL 5.5, the 'yum grouplist -v' portion of the command produces the following for one of the groups:
KDE (K Desktop Environment) (kde-desktop)
So the rest of the processing turns this into "K Desktop Environment" instead of "kde-desktop". I used a little awk to fix that one.
For RHEL 6.1 I didn't like that all the languages are listed and time is spent looking through them. 99.9%+ of the time I will not be looking for something in a language group, so I eliminated them with a little more grep to eliminate them, which all seemed to have [text] associated with them.
The net change to your code looks like this:
Code:
#!/bin/bash
yum grouplist -v | grep "^ " | grep -v "]$" | awk '{print $NF}' | sed -e "s/(//" | sed -e "s/)//" > /tmp/yum.grouplist
for GROUP in `cat /tmp/yum.grouplist`
do
name=`yum groupinfo "$GROUP" 2>&1 | grep -i $1`
if [[ $? -eq 0 ]] # $? is status of last cmd in pipe ie matched
then
echo $GROUP : $name
fi
done
rm /tmp/yum.grouplist
Hope someone else finds this useful,
Kevin