联盟域名:www.cn-dos.net 论坛域名:www.cn-dos.net/forum DOS,代表着自由开放与发展,我们努力起来,学习FreeDOS和Linux的自由开放与GNU精神,共同创造和发展美好的自由与GNU GPL世界吧!
for /f "tokens=5 delims= " %i in (1.txt) do @>>2.txt echo\%i
Originally posted by Batcher at 2008-9-24 03:33 PM:for /f "tokens=5 delims= " %i in (1.txt) do @>>2.txt echo\%i
@echo off >2.txt type nul for /f "tokens=1 delims=." %%a in (1.txt) do ( setlocal enabledelayedexpansion set "str=%%a" set "str=!str:~-15,5!" >>2.txt echo\!str! endlocal )
Originally posted by Batcher at 2008-9-24 03:48 PM: [code]@echo off >2.txt type nul for /f "tokens=1 delims=." %%a in (1.txt) do ( setlocal enabledelayedexpansion set "str=%%a" set "str=!str:~-15,5!" &g ...
C:\Test>type 1.txt 6 齐齐哈尔 50745 47.38 123.92 7 海 伦 50756 47.43 126.97 8 富 锦 50788 47.23 131.98 9 佳 木 斯 50873 46.49 130.17 10 鸡 西 50978 45.28 130.95 11 哈 尔 滨 50953 45.75 126.77 12 牡 丹 江 54094 44.57 129.60 C:\Test>type test.bat @echo off >2.txt type nul for /f "tokens=1 delims=." %%a in (1.txt) do ( setlocal enabledelayedexpansion set "str=%%a" set "str=!str:~-15,5!" >>2.txt echo\!str! endlocal ) C:\Test>test.bat C:\Test>type 2.txt 50745 50756 50788 50873 50978 50953 54094
Originally posted by Batcher at 2008-9-24 04:03 PM: 哥们,咋个不行法?
附件 1: 1.txt (2008-9-24 16:14, 5.67 K,下载次数: 5)
@echo off >2.txt type nul for /f "tokens=3 delims= " %%a in (1.txt) do ( >>2.txt echo %%a )
Originally posted by Batcher at 2008-9-24 04:23 PM: 你的文本列之间是用制表符tab分割的 论坛程序会把制表符转换成8个空格 运行下面的代码之前请自行把delims=后面的8个空格改成1个制表符 [code]@echo o ...