【发布时间】:2014-09-07 12:43:15
【问题描述】:
我有一个 nmap 输出文件,其中包含类似于 -
的数据Nmap scan report for myserver1 (11.11.11.11)
OS CPE: cpe:/o:microsoft:windows_server_2003::sp2
OS details: Microsoft Windows Server 2003 SP2
Nmap scan report for myserver2 (22.22.22.22)
OS CPE: cpe:/o:microsoft:windows_server_2003::sp2
OS details: Microsoft Windows Server 2003 SP2
Nmap scan report for 33.33.33.33
OS CPE: cpe:/o:microsoft:windows_xp::sp3
Aggressive OS guesses: Microsoft Windows XP SP3 (98%), Microsoft Windows Server 2003 SP2 (96%), Microsoft Windows XP (94%), Microsoft Windows Server 2003 SP0 or Windows XP SP2 (94%), Microsoft Windows XP SP2 (94%), Microsoft Windows XP SP2 - SP3 (94%), Microsoft Windows Server 2003 SP1 or SP2 (92%), Microsoft Windows XP SP2 or SP3 (91%), Microsoft Windows Server 2003 (91%), Belkin OmniView KVM switch or SMA Sunny WebBox solar panel monitor (90%)
No exact OS matches for host (test conditions non-ideal).
....etc
我想将特定于每个服务器的所有行合并为一行,从“Nmap 扫描报告”开始。每个服务器的行数可以是可变的,所以我不能使用 grep -A。有人有什么建议吗?
【问题讨论】:
-
我有一个代码,但我想先知道你用它做什么:)
-
真的有那些空行吗?