Assistance with my one line command to find all inactive kernels

Hello Forum,

I'm using the following command to find all inactive kernels installed on my RHEL server:

$ rpm -qa | grep '^kernel-[0-9]' |grep -vE `uname -r`

but the result is in two lines:

kernel-3.10.0-1062.1.1.el7.x86_64
kernel-3.10.0-1062.el7.x86_64

Is there a one line command I can issue to find all inactive kernels like I'm using but put all the kernels found on one line separated by a semi-colon (I use CSV for my output file so I don't want them separated by commas).

Thank you.

Please provide the results of this command (into code tags) in your reply:

rpm -qa | grep tail -35

... so everyone can see the input data you are working with.

Thanks.

1 Like

If you append | paste -sd \; to the command then you get them in semi-colon separated fields in one line..

1 Like

Hello Scrutinizer,

Thank you, this was the command I needed! Thanks very much for your help.

Hello Neo, the command you asked me to issue on my server returned no value. But Scrutinizer answer has helped me with my issue.

Thank you all.