I use 3 different kernels: 5.19.1-xanmod1-x64v2, 5.19.1-051901-generic, and 5.18.0-17.1-liquorix-amd64. Conky uses $kernel to display the full kernel version I'm using at the time. I want to to display the info on two lines like so:
5.19.1
xanmod1-x64v2
5.19.1-051901
generic
5.18.0-17.1
liquorix-amd64
I can get the first part by using ${exec uname -r | sed "s/ -[a-z].//"} but can't figure out a way to get the second part. Any suggestions? Thanks.
It's considerably more complex, but the command
sed 's/\([0-9][\.0-9]*\)\([-0-9][\.0-9]*\)\?-\(.*\)/\1\2\n\3/'
outputs info for each of your kernels on two lines, as shown below.
[David@Fedora64 ~]$ echo 5.19.1-051901-generic | sed 's/\([0-9][\.0-9]*\)\([-0-9][\.0-9]*\)\?-\(.*\)/\1\2\n\3/'
5.19.1-051901
generic
[David@Fedora64 ~]$ echo 5.19.1-xanmod1-x64v2 | sed 's/\([0-9][\.0-9]*\)\([-0-9][\.0-9]*\)\?-\(.*\)/\1\2\n\3/'
5.19.1
xanmod1-x64v2
[David@Fedora64 ~]$ echo 5.18.0-17.1-liquorix-amd64 | sed 's/\([0-9][\.0-9]*\)\([-0-9][\.0-9]*\)\?-\(.*\)/\1\2\n\3/'
5.18.0-17.1
liquorix-amd64