Board logo

标题: [文本处理] 帮忙写个批处理整理下IP [打印本页]

作者: yyakk    时间: 2017-7-29 15:16     标题: 帮忙写个批处理整理下IP

179.182.202.133|root|root|Brazil|BR|Unknown|Unknown|Unknown
179.182.202.133|root|root|Brazil|BR|Unknown|Unknown|Unknown
179.182.202.133|root|root|Brazil|BR|Unknown|Unknown|Unknown
179.182.202.132|root|root|Brazil|BR|Unknown|Unknown|Unknown
179.182.202.133|root|root|Brazil|BR|Unknown|Unknown|Unknown




整理出如下格式  


179.189.201.133 root root

拜谢
作者: PS2.0    时间: 2017-7-29 21:03

test.ps1
  1. gc 1.txt | %{($_ -split '\|')[0,1,2] -join ' '} > 2.txt
复制代码

作者: 再世情緣    时间: 2017-7-30 08:13

  1. for /f "tokens=1-3 delims=|" %%a in (ip.txt) do (echo %%a %%b %%c)
复制代码





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