Summary of client activity for the last 24 hours
我有一封普通邮件,在我认为它最适合 sed之前,我需要删除所有内容。
我搜索了互联网,但它只是带有分隔符或类似的东西。
你有什么想法吗?
邮件部分:
...(Personal Part of the Email)...
...
The following clients have no associated schedule
NodeDomainContact
-KABA-FILESYSTEM-
-USTICA-FILESYSTEM-
Summary of client activity for the last 24 hours
DomainNodenamePlatformTypeActivityData amountElapse timeAffectedFailedMedia wait
-FILESYSTEM-ABSYNTHE-Linux x86-64-XFS-
BACKUP-
337.5 MB-
00:00-
60-
0-
0
...
Run Code Online (Sandbox Code Playgroud)
期望的输出:
Summary of client activity for the last 24 hours
DomainNodenamePlatformTypeActivityData amountElapse timeAffectedFailedMedia wait
-FILESYSTEM-ABSYNTHE-Linux x86-64-XFS-
BACKUP-
337.5 MB-
00:00-
60-
0-
0
...
Run Code Online (Sandbox Code Playgroud)
使用 awk:
awk '/Summary of client activity for the last 24 hours/{p=1}p' file
Run Code Online (Sandbox Code Playgroud)
或 sed:
sed -n '/Summary of client activity for the last 24 hours/,$p' file
Run Code Online (Sandbox Code Playgroud)
使用 awk 测试您的电子邮件示例(上面的 sed cmd 具有相同的输出):
kent$ cat f
...(Personal Part of the Email)...
...
The following clients have no associated schedule
NodeDomainContact
-KABA-FILESYSTEM-
-USTICA-FILESYSTEM-
Summary of client activity for the last 24 hours
DomainNodenamePlatformTypeActivityData amountElapse timeAffectedFailedMedia wait
-FILESYSTEM-ABSYNTHE-Linux x86-64-XFS-
BACKUP-
337.5 MB-
00:00-
60-
0-
0
...
kent$ awk '/Summary of client activity for the last 24 hours/{p=1}p' f
Summary of client activity for the last 24 hours
DomainNodenamePlatformTypeActivityData amountElapse timeAffectedFailedMedia wait
-FILESYSTEM-ABSYNTHE-Linux x86-64-XFS-
BACKUP-
337.5 MB-
00:00-
60-
0-
0
..
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
18376 次 |
| 最近记录: |