Board logo

标题: [文本处理] 批处理如何吧文本的前后顺序替换一下 [打印本页]

作者: cry5812    时间: 2019-12-24 14:36     标题: 批处理如何吧文本的前后顺序替换一下

http://s2sdd211.cn.m3u8|谢谢大家|http://s2sd.com/vod.gi
谢谢大家|http://s2sdd211.cn.m3u8|http://s2sd.com/vod.gi   替换成这样 | 是分隔符
作者: went    时间: 2019-12-24 15:22

  1. @echo off
  2. (
  3. for /f "delims=" %%i in (test.txt) do (
  4. for /f "tokens=1-3 delims=|" %%a in ("%%i") do (
  5. echo %%b^|%%a^|%%c
  6. )
  7. )
  8. ) > new.txt
  9. echo 完成
  10. pause&exit
复制代码
test.txt是你的文本,一行一个链接
作者: Batcher    时间: 2019-12-24 15:52

回复 1# cry5812
  1. gawk "BEGIN{FS=OFS=\"^|\"}{print $2,$1,$3}" "1.txt" > "2.txt"
复制代码

作者: cry5812    时间: 2019-12-25 16:52

回复 2# went


    测试了不行
作者: cry5812    时间: 2019-12-25 16:52

回复 3# Batcher


    测试了不行  老哥
作者: Batcher    时间: 2019-12-27 21:12

回复 4# cry5812


参考Q-04
https://mp.weixin.qq.com/s/6lbb97qUOs1sTyKJfN0ZEQ
作者: Batcher    时间: 2019-12-27 21:13

回复 5# cry5812


可能是你没有下载gawk
http://bcn.bathome.net/s/tool/index.html?key=gawk




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