On 15/08/14 15:14, Barry Drake wrote:
Thanks Alan. That is really neat. I've run the first part of the
command and the three variables are precisely what I want. I'll amend
the script just a little and keep it in my home directory with other
neat little scripts I use from time to time.
I've just run this as a test - and it gives me all the kernels I want to
purge. Thanks.
( \
KERNEL_HIGHEST=$(dpkg -l 'linux-image-[0-9.]*-[0-9]*-[a-zA-Z0-9]*' |
grep ^ii | awk '{print $2}' | sort -V | tail -n 1 | sed
's/^linux-image-\([0-9.]*-[0-9]*\)-.*$/\1/') ; \
KERNEL_2ND_HIGHEST=$(dpkg -l 'linux-image-[0-9.]*-[0-9]*-[a-zA-Z0-9]*' |
grep ^ii | awk '{print $2}' | sort -V | tail -n 2 | head -n 1| sed
's/^linux-image-\([0-9.]*-[0-9]*\)-.*$/\1/') ; \
KERNEL_CURRENT=$(uname -r | sed "s/\(.*\)-\([^0-9]\+\)/\1/") ; \
echo $(dpkg -l 'linux-*-[0-9-]*' | grep ^ii | awk '{print $2}' | sed
"/$KERNEL_CURRENT/d;/$KERNEL_HIGHEST/d;/$KERNEL_2ND_HIGHEST/d" ) ; \
)
--
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-uk
https://wiki.ubuntu.com/UKTeam/