中国DOS联盟论坛

China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --
Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
Guest | Log in | Register | Members | Search | China DOS Union
中国DOS联盟论坛
The time now is 2026-08-08 22:24
47,811 topics / 349,895 posts / today 0 new / 48,253 members
DOS批处理 & 脚本技术(批处理室) » Remove duplicate lines
Printable Version  2,635 / 16
Floor1 xycoordinate Posted 2008-01-14 09:26
中级用户 Posts 228 Credits 493 From 安徽
There is a text:

Wang A male 340505
Wang B male 340503
Wang A male 340505
Wang B male 340503
Wang B male 340503
Wang C female 340502
Wang A male 340505

Want to eliminate duplicate rows, get

Wang A male 340505
Wang B male 340503
Wang C female 340502

???????
Floor2 jmz573515 Posted 2008-01-14 09:44
银牌会员 Posts 464 Credits 1,212
```
@echo off
for /f "delims=" %%i in (a.txt) do (
findstr /c:"%%i" b.txt 2>nul||echo %%i>>b.txt
)
pause
```

[ Last edited by jmz573515 on 2008-1-14 at 09:49 AM ]
Floor3 xycoordinate Posted 2008-01-14 10:06
中级用户 Posts 228 Credits 493 From 安徽
Floor4 lxmxn Posted 2008-01-14 18:26
版主 Posts 4,938 Credits 11,386
### bat


### awk
Floor5 HAT Posted 2008-01-14 20:53
版主 Posts 5,017 Credits 9,023
排序
Floor6 honghunter Posted 2008-01-14 21:12
中级用户 Posts 135 Credits 321
Originally posted by HAT at 2008-1-14 08:53 PM:
sort


What you said is not for Windows, I see that the sort in Windows XP seems to not have the -u parameter.
Floor7 HAT Posted 2008-01-14 21:58
版主 Posts 5,017 Credits 9,023
Originally posted by honghunter at 2008-1-14 09:12 PM:

What you mentioned is not under Windows, I see that the sort in Windows XP does not have the -u parameter.

Yes
Upon seeing the moderator mention awk, I thought of sort呵呵
Floor8 zyz0304360 Posted 2008-01-14 22:08
中级用户 Posts 123 Credits 257 From 烟台
Learning
Floor9 lixuej Posted 2008-01-15 09:07
新手上路 Posts 4 Credits 10
Learning
Floor10 grapeskin Posted 2008-01-15 17:09
初级用户 Posts 54 Credits 123
Learned another trick, every time I come here I gain something, heh heh
Floor11 moniuming Posted 2008-01-22 14:25
银牌会员 Posts 574 Credits 1,335 From 广西
What are the meanings of the moderator's echo %bg% off and echo\[%%a]? May I ask if they can be explained? Also, it can be displayed normally without removing %bg% and \[]
Floor12 NaturalJ0 Posted 2008-02-19 18:43
银牌会员 Posts 533 Credits 1,181
set %%a=batch
I didn't understand this sentence.
==================
Oh, I didn't get it for a moment, but I figured it out and bumped an old post.

[ Last edited by NaturalJ0 on 2008-2-19 at 06:48 PM ]
Floor13 zerocq Posted 2008-02-19 20:47
中级用户 Posts 196 Credits 458
uniq.exe 1.txt>2.txt
Floor14 bobo247 Posted 2008-02-20 09:47
初级用户 Posts 14 Credits 34
It seems that "!%%a!" might be a specific custom-defined placeholder or an identifier with no universal standard meaning in a general sense. Without more context from the specific context of the China DOS Union forum where this appears, it's difficult to give an extremely precise interpretation. It could be something related to a particular script, macro, or local convention within that forum's discussions.
Floor15 ansipeter Posted 2008-02-20 11:48
中级用户 Posts 130 Credits 269
Strictly speaking, it would be better if the second floor added the /X parameter
1 2  Next
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023