I am writing a little program that packages configuration files as rpm, and it puts a series of %triggers to handle installation/upgrade of the packages that bring a copy/version of the same file.
I am stuck trying to format yum provides output. The default output is:
# yum provides */named.conf -q
32:bind-chroot-9.8.2-0.17.rc1.el6_4.6.i686 : A chroot runtime environment for the ISC BIND DNS server, named(8)
Repo : base
Matched from:
Filename : /var/named/chroot/etc/named.conf
sblim-cmpi-dns-test-1.0-1.el6.i686 : SBLIM WBEM-SMT Dns - Testcase Files
Repo : base
Matched from:
Filename : /usr/share/sblim-testsuite/named.conf
But i need only the package name. Using cut
does not seem like a good idea. The delimiter would be - but there are several packages with a - in the middle of the package name.
Ideally I'd need the output to be formattable like for rpm queries:
rpm -qa --queryformat "%{NAME}\n"
make
rubygem-multi_json
attr
ncurses-base
rubygem-rack-test
strace
rubygem-polyglot
gpg-pubkey
rubygem-journey
tzdata
...