2017-03-01 114 views
-2

我有兩個文件A和B.比較和使用grep shell腳本

一個看起來像

2024007 current events rules 
2024008 current events rules 
2024009 current events rules 
2024010 current events rules 
2024011 current events rules 
2024012 current events rules 
2024013 current events rules 
2024014 current events rules 
2024015 current events rules 
2024016 current events rules 
2024017 current events rules 
2520160 tor rules 
2520161 tor rules 
2520162 tor rules 

和文件B也有

1326 ActiveX Attack Rules 
1327 Attack Response Rules 
1328 BOTCC Portgrouped Rules 
1329 BOTCC Rules 
1330 CHAT Rules 
1331 CIARMY Rules 
1332 Compromised IP Rules 
1333 Current Event Rules 
1334 Deleted Rules 
1335 DNS Attack Rules 
1336 DOS Attack Rules 
1337 DROP Rules 
1338 Dshield Rules 
1339 Exploit Rules 
1340 FTP Attack Rules 
1341 GAMES Rules 
1342 ICMP INFO Attack Rules 
1343 ICMP Attack Rules 
1344 IMAP Attack Rules 
1345 Inappropriate Website Access Rules 
1346 INFO Rules 
1347 Malware Rules 
1348 Miscellaneous Rules 

我需要搜索規則類別(當前事件規則等)從文件B - > A,並且如果它匹配,則將規則類別(如1326-48)旁邊的文件B中存儲的標識存儲在文件B中。並與存在於文件A.

+1

看起來是時候寫一些代碼了! –

+0

上面的數據是以列分隔的格式表示的...... – mahi

+0

這兩個文件之間沒有共同的字段。 –

回答

0

的ID在我的觀點數據庫更新沒有足夠的信息來幫助你,因爲我想,但是從我的理解,你應該看看perl腳本

用Perl,你就可以輕鬆地解析您的文件和你想與你的DATAS什麼......

希望它能幫助。