Board logo

标题: [文本处理] BAT批处理如何把IP地址B段区间给顺序展开? [打印本页]

作者: jk517    时间: 2014-5-12 15:31     标题: BAT批处理如何把IP地址B段区间给顺序展开?

如下
1.12.0.0-1.15.255.255
1.24.0.0-1.31.255.255
58.99.128.0-58.101.255.255
如何变为以下这种排序,就是把B段区间给顺序展开,C段在- 后面统一变为255
1.12.0.0-1.12.255.255
1.13.0.0-1.13.255.255
1.14.0.0-1.14.255.255
1.15.0.0-1.15.255.255
1.24.0.0-1.24.255.255
1.25.0.0-1.25.255.255
1.26.0.0-1.26.255.255
1.27.0.0-1.27.255.255
1.28.0.0-1.28.255.255
1.29.0.0-1.29.255.255
1.30.0.0-1.30.255.255
1.31.0.0-1.31.255.255
58.99.128.0-58.99.255.255
58.100.128.0-58.100.255.255
58.101.128.0-58.101.255.255
作者: apang    时间: 2014-5-12 16:34

  1. @echo off
  2. (for /f "tokens=1-6delims=.-" %%a in (a.txt) do (
  3.     for /l %%i in (%%b 1 %%f) do (
  4.         echo %%a.%%i.%%c.%%d-%%a.%%i.255.255
  5.     )
  6. ))>b.txt
  7. pause
复制代码

作者: jk517    时间: 2014-5-14 16:37

  非常感谢 已搞定!




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