a.txt
192.168.1.158
192.168.1.239
192.168.1.115
192.168.1.180
192.168.1.203
192.168.1.110
192.168.1.219
b.txt
192.168.1.158
192.168.1.239
192.168.1.115
192.168.1.180
192.168.1.203
192.168.1.110
请教各位大侠如何用用 shell 脚本对比 a.txt 和 b.txt 输出两个 IP 文件中不同的 IP:192.168.1.219
1
noqwerty 2021-03-13 22:37:46 +08:00 via Android
diff | grep
|
2
qq674949301 OP @noqwerty 那具体的操作命令是咋样子的呢 老哥
|
3
qq674949301 OP 顶一顶
|
4
oott123 2021-03-13 22:53:38 +08:00
cat a.txt b.txt | sort | uniq -c
|
5
eason1874 2021-03-13 22:55:20 +08:00
comm -3 a.txt b.txt > c.txt
|
6
Tumblr 2021-03-13 23:08:27 +08:00
给个 PowerShell 的参考一下吧:
Compare-Object (gc a.txt) (gc b.txt) |
7
alvin2ye 2021-03-17 09:48:23 +08:00
git diff a.txt b.txt
|