[17:05:54 root @ test ~]# awk -F\' '$1=="menuentry " {print i++ " : " $2}' /etc/grub2.cfg 0 : CentOS Linux (4.18.16-300.fc29.x86_64) 7 (Core) 1 : CentOS Linux (3.10.0-1127.19.1.el7.x86_64) 7 (Core) 2 : CentOS Linux (3.10.0-957.el7.x86_64) 7 (Core) ……