#!/bin/env python
# coding:utf-8
#程序功能是为了完成判断文件中是否有重复句子
#并将重复句子打印出来
res_list = []
f = open('./downloadmd5.txt','r')
res_dup = []
index = 0
file_dul = open('./r_d.txt', 'w')
file_last = open('./r_nd.txt','w')
for line in f.readlines():
index = index + 1
if line in res_list:
temp_str = ""
#temp_str = temp_str + str(index) + ',' #要变为str才行
temp_line = ''.join(line)
temp_str = temp_str+temp_line
#最终要变为str类型
file_dul.write(temp_str); #将重复的存入到文件中
else:
res_list.append(line)
file_last.write(line)
#!/bin/env python
# coding:utf-8
import re
res_list = []
f = open('./md5.txt','r')
f2 = open('./virus.conf','r')
index = 0
#没重复的文件名
file_dul = open('./m_nd.txt', 'w')
#重复的文件名
file_ex = open('./m_d.txt', 'w')
virstr = f2.read();
for line in f.readlines():
line=line.strip('\n')
if(re.search(line, virstr)):
line = line + '\n'
file_ex.write(line);
#调用删除rm -rf filename
else:
line = line+'\n'
file_dul.write(line);