联盟域名:www.cn-dos.net 论坛域名:www.cn-dos.net/forum DOS,代表着自由开放与发展,我们努力起来,学习FreeDOS和Linux的自由开放与GNU精神,共同创造和发展美好的自由与GNU GPL世界吧!
Originally posted by everest79 at 2007-4-21 04:41: 我的这个只能将重复的行删掉 a a b c d a b c d 并不能 a a b c d b c d src.txt是你原来的文本,执行完后dst.txt是过滤后的文本,将cmd切换到保存src.txt的目录下,再执行上边一行
@echo off setlocal enabledelayedexpansion cd.>temp.txt for /f "tokens=* delims=:" %%i in ('findstr /n ".*" test.txt') do ( echo %%i>>temp.txt ) for /f "tokens=1* delims=:" %%m in (temp.txt) do ( for /f "tokens=1* delims=:" %%x in ('findstr /v /c:"%%m:" temp.txt') do ( if "%%n"=="%%y" ( set str=%%y !str! ) ) ) findstr /v "!str!" test.txt pause
Originally posted by chishingchan at 2007-9-26 22:22: 16楼的代码不行 D:\DOCUME~1\ADMINI~1>for /f "delims=" %i in (test.txt) do if not defined %i set %i=a&echo %i D:\DOCUME~1\ADMINI~1>if not defined aa set aa=a & ech ...
Originally posted by huzixuan at 2007-4-21 07:37 AM: for /f "delims=" %%i in (test.txt) do if not defined %%i set %%i=a&echo %%i
Originally posted by bray at 2008-8-28 05:42 PM: set %%i=a 有什么用处?