【发布时间】:2020-02-05 07:35:31
【问题描述】:
我的输入文件如下:
OS ABI
UNIX - System V
CPU Class
64-bit
Persistence (user)
No
File type
ELF 32-bit MSB executable, PowerPC or cisco 4500, version
(SYSV),statically linked, not stripped,32-bit MSB executable,
PowerPC or cisco 4500, version (SYSV),statically linked, not stripped
CPU Type
PowerPC
我想输出为:
OS ABI UNIX - System V
CPU CLASS 64-bit
Persistence (user) No
File Type ELF 32-bit MSB executable, PowerPC or cisco 4500, version (SYSV),statically linked, not stripped,32-bit MSB executable, PowerPC or cisco 4500, version (SYSV),statically linked, not stripped
CPU Type PowerPC
请建议使用 awk 的脚本/命令可以输出所需的结果?当我们必须解析多行时,问题就出现了,如字段 5 所示。我还希望计算每个字段中的行数,例如:字段 1 有一行,字段 5 有 2 等等。
【问题讨论】: