我有一个包含以下示例数据的输入文件。
kernel_version 主机名
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
我想输出唯一的内核版本,以及哪个 dcs 正在运行哪个。
例如;
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
实现这一目标的最佳方法是什么?