date -d "+10 days" +%W
########查看距离现在的某天是一年的第n周##############
cat t1.txt
aa=11111
bb=22222
codfei]# vi -c ":%s/^aa=.*/aaa=/g" t1.txt
#############vi -c 直接对文件进行vi编辑###################
codfei]# cat t2.txt
eqewqewqeqw
eqwewqeqw
ee
qwe
qw
#eqw
#e
#qwe
#qw
eqwe
qweqw
eqweqw
e
qwe
codfei]# sed '6,9s/^#//' t2.txt
eqewqewqeqw
eqwewqeqw
ee
qwe
qw
eqw
e
qwe
qw
eqwe
qweqw
eqweqw
e
qwe
##############删除制定行的#################
codfei]# ll
total 28
-rw-r--r-- 1 root root 9 Apr 11 08:39 1
-rw-r--r-- 1 root root 35 Apr 7 11:11 3
-rw-r--r-- 1 root root 72 Apr 7 11:34 4
-rw-r--r-- 1 root root 698 Apr 7 12:42 5
-rw-r--r-- 1 root root 56 Apr 9 08:12 a.txt
-rw-r--r-- 1 root root 18 Apr 16 09:16 t1.txt
-rw-r--r-- 1 root root 73 Apr 16 09:55 t2.txt
codfei]# rename txt xxx *.txt
codfei]# ll
total 28
-rw-r--r-- 1 root root 9 Apr 11 08:39 1
-rw-r--r-- 1 root root 35 Apr 7 11:11 3
-rw-r--r-- 1 root root 72 Apr 7 11:34 4
-rw-r--r-- 1 root root 698 Apr 7 12:42 5
-rw-r--r-- 1 root root 56 Apr 9 08:12 a.xxx
-rw-r--r-- 1 root root 18 Apr 16 09:16 t1.xxx
-rw-r--r-- 1 root root 73 Apr 16 09:55 t2.xxx
codfei]# for file in *.xxx; do mv $file ${file/%.xxx/.txt}; done
codfei]# ll
total 28
-rw-r--r-- 1 root root 9 Apr 11 08:39 1
-rw-r--r-- 1 root root 35 Apr 7 11:11 3
-rw-r--r-- 1 root root 72 Apr 7 11:34 4
-rw-r--r-- 1 root root 698 Apr 7 12:42 5
-rw-r--r-- 1 root root 56 Apr 9 08:12 a.txt
-rw-r--r-- 1 root root 18 Apr 16 09:16 t1.txt
-rw-r--r-- 1 root root 73 Apr 16 09:55 t2.txt
##############将文件的后缀改名 直接rename########
codfei]# cat t3.txt
fetion.im
baike.baidu.com
cache.baidu.com
fetion.haofanwen.com
12520.js.cn
zhidao.baidu.com
tieba.baidu.com
qqjia.com
gaojingquan.jishuqi.com
g7a58.mail.163.com
g7a57.mail.163.com
g6a70.mail.163.com
codfei]# sed -r '
s/(.*)\.([^.]+)(.js.cn|.com.cn|.net.cn)/\1\n\2\3/;
/\n/!s/(.*)\.([^.]+)(.com|.cn|.net)/\1\n\2\3/;
s/.*\n//' t3.txt
xinyou-feixin.cn
fetion.im
qqkj.cn
baidu.com
free9.net
feixin2006.com.cn
baidu.com
haofanwen.com
js.cn
feixinsoft.cn
xinyou.com
baidu.com
xici.net
baidu.com
voipshow.net.cn
qqjia.com
cnyouhui.com
jishuqi.com
163.com
163.com
163.com
sina.com.cn
##############提取出域名#########没法完善乱七八糟##########################################
[irsir@localhost Work]$ cat countries
cn
jp
[irsir@localhost Work]$ cat domains
com
net
im
js
[irsir@localhost Work]$ cat xdomain.awk
BEGIN{
FS="."; OFS=".";
while(getline c < "countries"){
c_arr[c] = 0;
}
while(getline d < "domains"){
d_arr[d] = 0;
}
}
{
if($NF in c_arr){
if(d_arr[$(NF-1)] != "")
print $(NF-2), $(NF-1), $NF
else
print $(NF-1), $NF
}else if(d_arr[$NF] != ""){
print $(NF-1), $NF
}else{
print "######error#######",$0
}
}
#############这个很牛逼####################################
阅读(1735) | 评论(0) | 转发(0) |