Skip to content

Commit a0c8bac

Browse files
committed
update
1 parent 077ff07 commit a0c8bac

File tree

3 files changed

+21
-1
lines changed

3 files changed

+21
-1
lines changed

linux-init-script/init_centos7.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ sleep 1
3636
# 安装必要支持工具及软件工具
3737
yum_update(){
3838
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
4040
}
4141

4242
# 设置时间同步 set time

shell/for.sh

+7
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,13 @@
55
##robert yu
66
##centos 6和centos 7
77

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+
815
##linux shell 按行循环读入文件
916
printf "*************************************\n"
1017
echo " cat file whiel read line"

shell/grep.sh

+13
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,19 @@ sed -n '/pattern1/!p' file.txt
4949
##删除两个文件相同部分
5050
grep -v -f file1 file2 && grep -v -f file2 file1
5151

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+
5265
##删除两个文件相同部分 实用comm
5366
comm -3 file1 file2
5467

0 commit comments

Comments
 (0)