parse a line for a particular value (specifically crashkernel)

Latest response

We are reviewing our environment and best-practices. One of the items of consideration is crashkernel. I am trying to figure out how to parse grub.conf to determine what the crashkernel is set to at boot time via grub (I'm not interested in what /proc/cmdline has at that time).

Consider the following 2 scenarios:
# grep crash /boot/grub/grub.conf
kernel /vmlinuz-2.6.18-348.12.1.el5 ro root=/dev/VolGroup00/LogVol01 quiet crashkernel=auto

# grep crash /boot/grub/grub.conf
kernel /vmlinuz-2.6.18-348.4.1.el5 ro root=/dev/VolGroup00/LogVol01 rhgb quiet crashkernel=128M@16M

I would like to return either
crashkernel=auto or crashkernel=128M@16M
or.. better yet
auto or 128M@16M

Responses