Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
ppabc committed Jan 29, 2018
1 parent 077ff07 commit a0c8bac
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
2 changes: 1 addition & 1 deletion linux-init-script/init_centos7.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ sleep 1
# 安装必要支持工具及软件工具
yum_update(){
yum update -y
yum install -y nmap unzip wget vim lsof xz net-tools iptables-services ntpdate ntp-doc
yum install -y nmap unzip wget vim lsof xz net-tools iptables-services ntpdate ntp-doc psmisc
}

# 设置时间同步 set time
Expand Down
7 changes: 7 additions & 0 deletions shell/for.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@
##robert yu
##centos 6和centos 7

##循环判断两文件,差集内容
for File in `cat aaa.txt`; do
f=`cat 222.log |grep "$File"`
if [ ! -n "$f" ]; then echo "$File" ; fi
##if [ "$f" == "" ]; then echo "$File" ; fi
done

##linux shell 按行循环读入文件
printf "*************************************\n"
echo " cat file whiel read line"
Expand Down
13 changes: 13 additions & 0 deletions shell/grep.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,19 @@ sed -n '/pattern1/!p' file.txt
##删除两个文件相同部分
grep -v -f file1 file2 && grep -v -f file2 file1

##计算并集
sort -u a.txt b.txt

##计算交集
grep -F -f a.txt b.txt | sort | uniq

##计算差集
grep -F -v -f b.txt a.txt | sort | uniq

sort a b b | uniq -u
#a b 排序,两个的交集出现次就是2 了,a b b 再排序。b里面的次数,最少是2了,交集里面的是3
然后再uniq -u 取出现一次的,就是想要的结果了

##删除两个文件相同部分 实用comm
comm -3 file1 file2

Expand Down

0 comments on commit a0c8bac

Please sign in to comment.