Hello everyone!
I use a script to query for installed packages with yum (I use RHEL 4 with yum installed) and the output is redirected to a file. My script scan this file to find a package and the version of it.
The script works fine until I search for a package name with special characters. So if I search for gcc.x86_64 I get all the info I need but if I search for gcc-c++.x86_64. I don't get anything.
My search string looks like this :
version=$(awk '/^gcc.x86_64/ { print $2}' /tmp/yum_output.txt)
The ouput of yum is :
Setting up repositories
Reading repository metadata in from local files
Installed Packages
gcc.x86_64 3.4.6-3 installed
So if I echo version, I get this :
# version=$(awk '/^gcc.x86_64/ { print $2}' /tmp/yum_output.txt)
# echo $version
3.4.6-3
#
When I do the same thing with gcc-c++.x86_64, I get nothing if I echo version.
# version=$(awk '/^gcc-c++.x86_64/ { print $2}' /tmp/yum_output.txt)
# echo $version
#
Is there any way I can get this to work?