I have a input file with the following example data.
kernel_version hostname
2.6.32-220.el6.x86_64 www01.dc1.domain.com
2.6.32-220.el6.x86_64 www02.dc1.domain.com
2.6.32-220.el6.x86_64 exc01.dc1.domain.com
2.6.32-220.el6.x86_64 exc02.dc1.domain.com
2.6.32-120.el6.x86_64 www03.dc2.domain.com
2.6.32-120.el6.x86_64 www04.dc2.domain.com
2.6.32-120.el6.x86_64 exc03.dc2.domain.com
2.6.32-120.el6.x86_64 exc04.dc2.domain.com
2.6.32-100.el6.x86_64 www05.dc3.domain.com
2.6.32-100.el6.x86_64 www06.dc3.domain.com
2.6.32-100.el6.x86_64 exc05.dc3.domain.com
2.6.32-100.el6.x86_64 exc06.dc3.domain.com
2.6.32-220.el6.x86_64 www07.dc4.domain.com
2.6.32-220.el6.x86_64 www08.dc4.domain.com
2.6.32-220.el6.x86_64 exc07.dc4.domain.com
2.6.32-220.el6.x86_64 exc08.dc4.domain.com
I’d like to output the unique kernel version, and which dcs are running which.
For example;
2.6.32-220.el6.x86_64 dc1, dc4
2.6.32-120.el6.x86_64 dc2
2.6.32-100.el6.x86_64 dc3
What is the best method to achieve this?
I’d do something like this:
Warning: I did not test this script. I am not responsible for any syntax errors, race conditions, or velociraptor attacks that may be caused by this code.. but it should get you startedEdit: I have now tested it. One syntactical error that has been rectified, and no major velociraptor attacks.