diff --git a/shell/awk.sh b/shell/awk.sh index bf8df81..32ec07a 100644 --- a/shell/awk.sh +++ b/shell/awk.sh @@ -5,6 +5,13 @@ ##robert yu ##centos 6和centos 7 +##按第六列 重复的删除,并保留一行 +awk '!arr[$6]++' file + +##按第2列和第三 重复的删除,并保留一行 +awk '!arr[$2$3]++' test.log +awk '!arr[$2_$3]++' test.log + ##提取两个文件第一列相同的行 awk -F',' 'NR==FNR{a[$1]=$0;next}NR>FNR{if($1 in a)print $0"\n"a[$1]}' 1.log 2.log diff --git a/shell/mail1.sh b/shell/mail1.sh new file mode 100644 index 0000000..d6c071d --- /dev/null +++ b/shell/mail1.sh @@ -0,0 +1,30 @@ +#!/bin/bash +## IMAP方式批量删除邮箱邮件 2017-08-05 +## http://www.aqzt.com +## email: ppabc@qq.com +## robert yu +## centos 7 +## crontab定时 0 */20 * * * bash /opt/sh/mail1.sh 500 | telnet imap.189.cn 143 +### 181503xxx@189.cn 替换为你的邮箱 +### password123 替换为你的邮箱密码 +### bash /opt/sh/mail1.sh 500 | telnet imap.189.cn 143 + +MAX_MESS=$1 +[ $# -eq 0 ] && exit 1 || : +sleep 2 +echo "A01 login 181503xxx@189.cn password123" +sleep 1 +echo "A02 LIST '' *" + +sleep 2 +echo "A03 Select INBOX" +sleep 2 +for (( j = 2 ; j <= $MAX_MESS; j++ )) +do +echo "A09 Store $j +FLAGS (\Deleted)" + +echo "A10 Expunge" +sleep 1 +done +echo QUIT +date >> /tmp/mail1.log