- 帖子
- 50
- 积分
- 68
- 技术
- 0
- 捐助
- 0
- 注册时间
- 2011-8-15
|
[文本处理] [已解决]批处理如何判断txt最后10行是否包含某些字符串并输出这些行?
判断一较大文件 123.txt的最后10行:如果含有字符串“错误” 和“AutoConfig”,则把该文件复制到指定位置d:\456.txt;
提取456.txt的倒数第4行的前6个字符,并输出最后20行中包含该6个字符串的所有行到一个文件d:\789.txt
批处理能快速做到这些吗?请大家帮忙,谢谢!
123.txt的内容
信息 2018/6/30 22:13:09 Microsoft-Windows-Kernel-General 1 无
信息 2018/6/30 22:11:10 Microsoft-Windows-Kernel-General 1 无
信息 2018/6/30 22:07:57 Service Control Manager
信息 2018/6/30 22:03:10 Service Control Manager
信息 2018/6/30 22:03:10 Service Control Manager
错误 2018/6/30 22:03:10 Service Control Manager
错误 2018/6/30 22:03:10 Service Control Manager
信息 2018/6/30 22:03:09 Microsoft-Windows-Kernel-General 1 无
信息 2018/6/30 22:03:07 Service Control Manager
信息 2018/6/30 22:03:05 Service Control Manager
信息 2018/6/30 22:03:05 Microsoft-Windows-WLAN-AutoConfig 4000 无
信息 2018/6/30 22:03:05 Service Control Manager
错误 2018/6/30 22:03:05 Service Control Manager
信息 2018/6/30 7:08:02 Service Control Manager
信息 2018/6/30 7:08:02 Service Control Manager
信息 2018/6/30 7:08:00 Microsoft-Windows-Winlogon 7001 -1101
信息 2018/6/30 7:08:00 Service Control Manager
信息 2018/6/30 7:08:00 Microsoft-Windows-WLAN-AutoConfig 4000 无
信息 2018/6/30 7:08:00 Service Control Manager
信息 2018/6/30 7:08:00 Microsoft-Windows-DHCPv6-Client 51046 服务状态事件
错误 2018/6/30 7:08:00 Service Control Manager
信息 2018/6/30 7:08:00 Microsoft-Windows-Dhcp-Client 50036 服务状态事件
信息 2018/6/30 7:08:00 Service Control Manager
信息 2018/6/30 7:08:00 Service Control Manager |
-
1
评分人数
-
|