标题: [文本处理] [已解决]批处理如何把TXT文本的内容按指定格式合并? [打印本页]
作者: iq301 时间: 2015-3-11 19:07 标题: [已解决]批处理如何把TXT文本的内容按指定格式合并?
各位亲们:
请教下,如何把这种文档按指定格式排序。实在没思路啦。。。
原文档:
DATE TIME CDUR
150121 145707 57
AAB
88913950
BBB
28783320D
DATE TIME CDUR
150121 145911 78
AAB
28714113
BBB
28783320D
DATE TIME CDUR
150121 150501 153
AAB
62128091
BBB
28783320D
DATE TIME CDUR
150121 153846 155
AAB
66693926
BBB
28783320D
排序后的文档:
DATE TIME CDUR ANB BNB
150121 145707 57 88913950 28783320D
150121 145911 78 28714113 28783320D
150121 150501 153 62128091 28783320D
150121 153846 155 66693926 28783320D
作者: 522235677 时间: 2015-3-11 19:34
- @echo off
- (for /f "skip=2 tokens=1*" %%a in (temp.txt) do (
- if %%a==DATE echo.
- if not %%a==ANB if not %%a==BNB if not %%a==DATE <nul set /p=%%a %%b
- ))>new.txt
复制代码
作者: 522235677 时间: 2015-3-11 19:36
150121 145707 57 88913950 28783320D
150121 145911 78 28714113 28783320D
150121 150501 153 62128091 28783320D
150121 153846 155 66693926 28783320D
150121 154644 360 85221183888 28783320D
150121 155316 205 28712866 28783320D
150121 155316 206 66627671 28783320D
150121 155749 42 28787003 28783320D
150121 155248 409 28781828 28783320D
150121 155958 260 28550590 28783320D
150121 161753 287 28823213 28783320D
150121 162245 168 63552670 28783320D
150121 163104 223 28715368 28783320D
150121 165148 177 66631341 28783320D
150121 165601 28713843 28783320D
150121 165636 305 66829395 28783320D
150121 170457 177 66307295 28783320D
150121 171728 58 66673956 28783320D
作者: iq301 时间: 2015-3-11 21:19 标题: RE: 批处理如何把TXT文档按指定格式排序?
回复 2# 522235677
thank your for your support
欢迎光临 批处理之家 (http://www.bathome.net/) |
Powered by Discuz! 7.2 |