this is the way when I try to get the Kafka version
rpm -qa | grep "^kafka_"
kafka_2_6_5_0_292-1.0.0.2.6.5.0-292.noarch
Kafka version is 1.0 , so I did the following in order to cut the Kafka version
rpm -qa | grep "^kafka_" | sed s'/-/ /g' | awk '{print $2}' | cut -c 1-3
1.0 <----- results
above cli seems to be not so elegant and long syntax
can we do it better , maybe with Perl or Python one liner command ?