标题: [文本处理] [批处理]如何将txt文件的多行内容合并成一行? [打印本页]
作者: hp051247767 时间: 2016-1-17 15:30 标题: [批处理]如何将txt文件的多行内容合并成一行?
TXT 內容如下- RecordNumber,EventID,TimeGenerated,Strings
- 460364752,5145,2016-01-07 16:00:01,"S-1-5-21-2637588964-3425828325-926418006-6806|ashwu|test|0x11db8817|File|192.168.0.131|1076|\\*\test|\??\E:\test|\|0x100080|%%1541
- %%4423
- %%1541: %%1801 D:(A;OICI;FA;;;WD)
- %%4423: %%1801 D:(A;OICI;FA;;;WD)
- "
- 460364753,5145,2016-01-07 16:00:01,"S-1-5-21-2637588964-3425828325-926418006-6806|ashwu|test|0x11db8817|File|192.168.0.135|1076|\\*\test|\??\E:\test|\|0x100080|%%1541
- %%4423
- %%1541: %%1801 D:(A;OICI;FA;;;WD)
- %%4423: %%1801 D:(A;OICI;FA;;;WD)
- "
复制代码
要使TXT档中的断行合并成如下的结果 请问该怎么做?- RecordNumber,EventID,TimeGenerated,Strings
- 460364752,5145,2016-01-07 16:00:01,"S-1-5-21-2637588964-3425828325-926418006-6806|ashwu|test|0x11db8817|File|192.168.0.131|1076|\\*\test|\??\E:\test|\|0x100080|%%1541%%4423%%1541: %%1801 D:(A;OICI;FA;;;WD)%%4423: %%1801 D:(A;OICI;FA;;;WD)"
- 460364753,5145,2016-01-07 16:00:01,"S-1-5-21-2637588964-3425828325-926418006-6806|ashwu|test|0x11db8817|File|192.168.0.135|1076|\\*\test|\??\E:\test|\|0x100080|%%1541%%4423%%1541: %%1801 D:(A;OICI;FA;;;WD)%%4423: %%1801 D:(A;OICI;FA;;;WD)"
复制代码
作者: bailong360 时间: 2016-1-17 16:47
- fr -r:"\r\n\t+" -t:"" test.txt
复制代码
作者: hp051247767 时间: 2016-1-17 17:15
回复 2# bailong360
可以了 谢谢
之前用sed都没办法
原来改fr就行了
作者: pcl_test 时间: 2016-1-17 19:46
水- //&cls&cscript -nologo -e:jscript "%~f0"<"a.txt">"b.txt"&pause&exit
- WSH.Echo(WScript.StdIn.ReadAll().replace(/\r\n[\t ]+/g, ''));
复制代码
欢迎光临 批处理之家 (http://www.bathome.net/) |
Powered by Discuz! 7.2 |