I have a list of currently installed kernels, and I'm trying to grep out both the currently installed kernel and the previously installed kernel. For this example, linux-image-3.2.0-60-generic is the currently running kernel, and these are the installed kernels:
linux-image-3.2.0-49-generic linux-image-3.2.0-51-generic linux-image-3.2.0-52-generic linux-image-3.2.0-53-generic linux-image-3.2.0-54-generic linux-image-3.2.0-55-generic linux-image-3.2.0-56-generic linux-image-3.2.0-57-generic linux-image-3.2.0-58-generic linux-image-3.2.0-59-generic linux-image-3.2.0-60-generic linux-image-3.2.0-61-generic linux-image-3.2.0-63-generic linux-image-3.2.0-64-generic
I can use
grep -v $(uname -r) to remove the currently running kernel from this list. However, I can't seem to use
grep -v -B 1 $(uname -r) to remove current and previous kernel from the list. Is there a way to combine the
-v? Or am I approaching this entirely from the wrong direction?