I am trying to compare the list of installed packages on a couple of computers running CentOS 6.4. The output of yum list installed
is not ordered nicely into three columns, e.g.:
ImageMagick.x86_64 6.5.4.7-6.el6_2 @base MAKEDEV.x86_64 3.24-6.el6 @anaconda-CentOS-201303020151.x86_64/6.4 ModemManager.x86_64 0.4.0-3.git20100628.el6 @anaconda-CentOS-201303020151.x86_64/6.4 NetworkManager.x86_64 1:0.8.1-43.el6 @anaconda-CentOS-201303020151.x86_64/6.4 NetworkManager-glib.x86_64 1:0.8.1-43.el6 @anaconda-CentOS-201303020151.x86_64/6.4
Long lines are wrapped to fit into 80 columns, which means that if I sort
this file the information for some packages will be scrambled.. Is there a simple awk command to take this output and print three fields per line?
I have tried searching for similar examples, but I only find cases where people split one long line into columns.
If each column is guaranteed not to contain spaces then this approach might do the trick:
$ yum list installed | xargs -n3 | column -t
ImageMagick.x86_64 6.5.4.7-6.el6_2 @base
MAKEDEV.x86_64 3.24-6.el6 @anaconda-CentOS-201303020151.x86_64/6.4
ModemManager.x86_64 0.4.0-3.git20100628.el6 @anaconda-CentOS-201303020151.x86_64/6.4
NetworkManager.x86_64 1:0.8.1-43.el6 @anaconda-CentOS-201303020151.x86_64/6.4
NetworkManager-glib.x86_64 1:0.8.1-43.el6 @anaconda-CentOS-201303020151.x86_64/6.4
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With