China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --

Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!

中国DOS联盟论坛
The time now is 2026-07-31 22:26
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » {Solved} How to compare file contents - for comparing MAC addresses View 3,574 Replies 22
Floor 16 Posted 2007-03-11 04:43 ·  中国 广东 清远 联通
高级用户
★★
Credits 846
Posts 247
Joined 2006-10-27 12:03
19-year member
UID 68504
Gender Male
From 湖南==》广东
Status Offline
To: CCWan
Brother, the command findstr /v /g:b.txt a.txt >1.txt seems to need to be changed to findstr /v /g:b.txt a.txt >>1.txt, which is more reasonable, right?
Floor 17 Posted 2007-03-11 04:46 ·  中国 河北 廊坊 三河市 移动
金牌会员
★★★★
Credits 2,725
Posts 1,160
Joined 2006-09-23 12:00
19-year member
UID 63486
From 河北廊坊
Status Offline
re youxi01
There is no need for that because it compares the entire content of the text at once, unlike for which loops sequentially. So even if there are many differences, it will all be output.
This is also what I found after testing. Brother, you can give it a try.
三人行,必有吾师焉。 学然后知不足,教然后知困,然后能自强也。
Floor 18 Posted 2007-03-11 05:04 ·  中国 广东 清远 联通
高级用户
★★
Credits 846
Posts 247
Joined 2006-10-27 12:03
19-year member
UID 68504
Gender Male
From 湖南==》广东
Status Offline
Got it, understand, thanks.
Floor 19 Posted 2007-03-11 07:13 ·  中国 湖北 武汉 电信
版主
★★★★★
Credits 11,386
Posts 4,938
Joined 2006-07-23 17:10
20-year member
UID 59080
Status Offline
Originally posted by chainliq at 2007-3-10 09:39:
Brother lxmxn, it seems like it didn't respond when running.

  When I first wrote it, the test was correct. Maybe you changed the contents of your a.txt and b.txt files, so it led to the "no response when running" you mentioned.

  The code has been updated, try again?
Floor 20 Posted 2007-03-13 04:26 ·  中国 广西 贵港 电信
高级用户
★★
学无尽止
Credits 635
Posts 244
Joined 2006-04-15 05:07
20-year member
UID 53857
Gender Male
From 广西贵港
Status Offline
Well, it's all right... Hehe``This is mainly to prevent ARP``In this case,``I'll re-collect the MACs of the following machines, and after comparison, I'll know which one is the culprit``,``Hehe``, everyone's methods are very good``Hehe``Learning in the process``

[ Last edited by chainliq on 2007-3-13 at 04:28 AM ]
学无尽止
Floor 21 Posted 2007-06-29 00:47 ·  中国 湖北 十堰 郧西县 联通
初级用户
Credits 38
Posts 20
Joined 2006-07-04 16:50
20-year member
UID 58001
Status Offline
The design of the landlord's question is problematic:

If I am one of the macs, originally using 254 for the IP, I change to 100 and no other mac is using the 254 IP anymore, how do you detect me?

It should be more reasonable to first judge the front and back macs and then see if the IP changes to report the MAC!

Although I am very naive and can't understand some commands of the experts upstairs, I think the idea of the LZ is indeed problematic!

[ Last edited by SunRiseBoy on 2007-6-29 at 12:57 AM ]
Floor 22 Posted 2007-06-29 08:31 ·  中国 河北 廊坊 三河市 移动
金牌会员
★★★★
Credits 2,725
Posts 1,160
Joined 2006-09-23 12:00
19-year member
UID 63486
From 河北廊坊
Status Offline
Everyone's code starts from comparing the differences between two texts, and I believe the LZ means the same.
三人行,必有吾师焉。 学然后知不足,教然后知困,然后能自强也。
Floor 23 Posted 2009-01-05 04:21 ·  中国 北京 科技网
初级用户
Credits 27
Posts 12
Joined 2008-08-22 17:48
17-year member
UID 123887
Gender Male
Status Offline
Originally posted by ccwan at 2007-3-11 03:48 AM:
Stop arguing. Everyone has different ways to solve problems, which is a good thing and can broaden our thinking, isn't it?

Let me solve it with one sentence.
findstr /v /g:b.txt a.txt >1.txt


So powerful! I spent an entire night writing a batch script and couldn't get it done

The version master solved it with one line of code...
Forum Jump: