Board logo

标题: [文本处理] 批处理如何将一列数字变成两列? [打印本页]

作者: qdlax123    时间: 2011-1-12 18:44     标题: 批处理如何将一列数字变成两列?

求助如何将一列数字批处理成两列啊

比如
[email=9105947@QQ.Com]9105947@QQ.Com[/email];
[email=9105947@QQ.Com]9105947@QQ.Com[/email];
[email=9105947@QQ.Com]9105947@QQ.Com[/email];
[email=9105947@QQ.Com]9105947@QQ.Com[/email];
[email=9105947@QQ.Com]9105947@QQ.Com[/email];
[email=9105947@QQ.Com]9105947@QQ.Com[/email];
[email=9105947@QQ.Com]9105947@QQ.Com[/email];
[email=9105947@QQ.Com]9105947@QQ.Com[/email];
[email=9105947@QQ.Com]9105947@QQ.Com[/email];
[email=9105947@QQ.Com]9105947@QQ.Com[/email];
[email=9105947@QQ.Com]9105947@QQ.Com[/email];
[email=9105947@QQ.Com]9105947@QQ.Com[/email];

批处理成这种格式

[email=9105947@QQ.Com]9105947@QQ.Com[/email];[email=9105947@QQ.Com]9105947@QQ.Com[/email];
[email=9105947@QQ.Com]9105947@QQ.Com[/email];[email=9105947@QQ.Com]9105947@QQ.Com[/email];
[email=9105947@QQ.Com]9105947@QQ.Com[/email];[email=9105947@QQ.Com]9105947@QQ.Com[/email];
[email=9105947@QQ.Com]9105947@QQ.Com[/email];[email=9105947@QQ.Com]9105947@QQ.Com[/email];
9105947@[email=QQ.Com9105947@QQ.Com]QQ.Com;[email=9105947@QQ.Com]9105947@QQ.Com[/email][/email];

高手求救 小弟在线等
作者: qdlax123    时间: 2011-1-12 18:56

高手来帮帮小弟,小弟在线等 急急 急急 急急
作者: hanyeguxing    时间: 2011-1-12 18:56

  1. @echo off
  2. (for /f "delims=" %%a in (a.txt) do (
  3. set/p"=%%a"<nul
  4. if defined n (
  5. echo/
  6. set n=
  7. ) else set n==
  8. ))>a_.txt
  9. move a_.txt a.txt
复制代码

作者: qdlax123    时间: 2011-1-12 19:01

谢谢 版主 感动的流泪
作者: sxw    时间: 2011-1-12 22:58

  1. sed "N;s/\n//" a.txt
复制代码
能处理偶数行
作者: Batcher    时间: 2011-1-13 00:28

  1. gawk "NR%2{printf $0;next}1" 1.txt
复制代码





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