Commit a0c8bac 1 parent 077ff07 commit a0c8bac Copy full SHA for a0c8bac
File tree 3 files changed +21
-1
lines changed
3 files changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ sleep 1
36
36
# 安装必要支持工具及软件工具
37
37
yum_update (){
38
38
yum update -y
39
- yum install -y nmap unzip wget vim lsof xz net-tools iptables-services ntpdate ntp-doc
39
+ yum install -y nmap unzip wget vim lsof xz net-tools iptables-services ntpdate ntp-doc psmisc
40
40
}
41
41
42
42
# 设置时间同步 set time
Original file line number Diff line number Diff line change 5
5
# #robert yu
6
6
# #centos 6和centos 7
7
7
8
+ # #循环判断两文件,差集内容
9
+ for File in ` cat aaa.txt` ; do
10
+ f=` cat 222.log | grep " $File " `
11
+ if [ ! -n " $f " ]; then echo " $File " ; fi
12
+ # #if [ "$f" == "" ]; then echo "$File" ; fi
13
+ done
14
+
8
15
# #linux shell 按行循环读入文件
9
16
printf " *************************************\n"
10
17
echo " cat file whiel read line"
Original file line number Diff line number Diff line change @@ -49,6 +49,19 @@ sed -n '/pattern1/!p' file.txt
49
49
# #删除两个文件相同部分
50
50
grep -v -f file1 file2 && grep -v -f file2 file1
51
51
52
+ # #计算并集
53
+ sort -u a.txt b.txt
54
+
55
+ # #计算交集
56
+ grep -F -f a.txt b.txt | sort | uniq
57
+
58
+ # #计算差集
59
+ grep -F -v -f b.txt a.txt | sort | uniq
60
+
61
+ sort a b b | uniq -u
62
+ # a b 排序,两个的交集出现次就是2 了,a b b 再排序。b里面的次数,最少是2了,交集里面的是3
63
+ 然后再uniq -u 取出现一次的,就是想要的结果了
64
+
52
65
# #删除两个文件相同部分 实用comm
53
66
comm -3 file1 file2
54
67
You can’t perform that action at this time.
0 commit comments