Board logo

标题: [文本处理] 如何删除/排除文本文档中特定内容行 [打印本页]

作者: sun_java1984    时间: 2016-7-29 10:08     标题: 如何删除/排除文本文档中特定内容行

比如附件VFT_01中,需要删除其中内容为: Date;Time;MID;"Machine state";"Sub state";Job;"Lens side";Comment的行和空的行,谢谢各位老师了.
原内容:
Date;Time;MID;"Machine state";"Sub state";Job;"Lens side";Comment
2015_11_21;05:17:27,742;rogramStart;--------;--------;--------;--------
2015_11_21;05:17:27,742;;NotReady;;;;
2015_11_21;05:17:48,602;;Error;;;;
2015_11_21;05:21:33,475;;NotReady;;;;
2015_11_21;05:21:45,562;;Error;;;;
2015_11_21;05:32:27,495;;NotReady;;;;
2015_11_21;05:33:01,324;;Error;;;;
2015_11_21;05:33:06,882;;NotReady;;;;
2015_11_21;05:35:54,082;;Error;;;;
2015_11_21;05:35:55,825;;NotReady;;;;
2015_11_21;05:36:47,579;;Error;;;;
2015_11_21;05:36:57,323;;NotReady;;;;
2015_11_21;05:38:00,975;;Error;;;;
2015_11_21;05:38:06,943;;NotReady;;;;
2015_11_21;05:40:46,293;;ProgramEnd;--------;--------;--------;--------
2015_11_21;05:44:05,722;;ProgramStart;--------;--------;--------;--------
2015_11_21;05:44:05,722;;NotReady;;;;
2015_11_21;05:44:55,573;;Error;;;;
2015_11_21;05:44:58,648;;ManualMode;;;;
2015_11_21;05:47:51,787;;NotReady;;;;
2015_11_21;05:48:36,160;;Error;;;;
2015_11_21;05:48:53,165;;ManualMode;;;;

Date;Time;MID;"Machine state";"Sub state";Job;"Lens side";Comment
2015_11_23;14:41:17,763;;Error;;;;

Date;Time;MID;"Machine state";"Sub state";Job;"Lens side";Comment
2015_11_24;04:55:50,370;;NotReady;;;;
2015_11_24;06:27:00,551;;ProgramStart;--------;--------;--------;--------
2015_11_24;06:27:00,561;;NotReady;;;;
2015_11_24;06:28:03,342;;WaitingForJobs;;;;
2015_11_24;06:28:22,109;;ManualMode;;;;
2015_11_24;06:29:01,365;;NotReady;;;;
2015_11_24;06:29:03,698;;ManualMode;;;;
2015_11_24;06:29:53,770;;NotReady;;;;
2015_11_24;06:29:57,025;;ManualMode;;;;

VBS改好后的内容为:
2015_11_21;05:17:27,742;;ProgramStart;--------;--------;--------;--------
2015_11_21;05:17:27,742;;NotReady;;;;
2015_11_21;05:17:48,602;;Error;;;;
2015_11_21;05:21:33,475;;NotReady;;;;
2015_11_21;05:21:45,562;;Error;;;;
2015_11_21;05:32:27,495;;NotReady;;;;
2015_11_21;05:33:01,324;;Error;;;;
2015_11_21;05:33:06,882;;NotReady;;;;
2015_11_21;05:35:54,082;;Error;;;;
2015_11_21;05:35:55,825;;NotReady;;;;
2015_11_21;05:36:47,579;;Error;;;;
2015_11_21;05:36:57,323;;NotReady;;;;
2015_11_21;05:38:00,975;;Error;;;;
2015_11_21;05:38:06,943;;NotReady;;;;
2015_11_21;05:40:46,293;;ProgramEnd;--------;--------;--------;--------
2015_11_21;05:44:05,722;;ProgramStart;--------;--------;--------;--------
2015_11_21;05:44:05,722;;NotReady;;;;
2015_11_21;05:44:55,573;;Error;;;;
2015_11_21;05:44:58,648;;ManualMode;;;;
2015_11_21;05:47:51,787;;NotReady;;;;
2015_11_21;05:48:36,160;;Error;;;;
2015_11_21;05:48:53,165;;ManualMode;;;;
2015_11_23;14:41:17,763;;Error;;;;
2015_11_24;04:55:50,370;;NotReady;;;;
2015_11_24;06:27:00,551;;ProgramStart;--------;--------;--------;--------
2015_11_24;06:27:00,561;;NotReady;;;;
2015_11_24;06:28:03,342;;WaitingForJobs;;;;
2015_11_24;06:28:22,109;;ManualMode;;;;
2015_11_24;06:29:01,365;;NotReady;;;;
2015_11_24;06:29:03,698;;ManualMode;;;;
2015_11_24;06:29:53,770;;NotReady;;;;
2015_11_24;06:29:57,025;;ManualMode;;;;
作者: gawk    时间: 2016-7-30 07:56

  1. findstr "^[0-9]" "VFT_01.txt" > "VFT_02.txt"
复制代码

作者: sun_java1984    时间: 2016-8-3 16:48

谢谢gawk , 能否用VBS来实现?
作者: gawk    时间: 2016-8-4 20:50

回复 3# sun_java1984


    VBS的问题怎么在BAT版块发帖?




欢迎光临 批处理之家 (http://www.bathome.net/) Powered by Discuz! 7.2