comparison of files
hello, I have been trying to write a shell script that will compare 2 files and generate a 3rd. i have a list of abusive IP's generated by our router. I want to compare it against a list of known abuse IPs ..and have it create a file of repeat offenders. ive tired to use comm to compare file1 against file2 doing something like comm -12i file1 file2 file3 however it doesnt seem to workany suggestions ? thank you for all your help in advance -- Brent Bailey CCNA Bmyster LLC Computer Networking and Webhosting Network Engineer, Webmaster, President http://www.bmyster.com [EMAIL PROTECTED] 207-247-8330 ___ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: comparison of files
On Tue, 16 Dec 2003 16:31:22 -0500 (EST) Brent Bailey [EMAIL PROTECTED] wrote: hello, I have been trying to write a shell script that will compare 2 files and generate a 3rd. i have a list of abusive IP's generated by our router. I want to compare it against a list of known abuse IPs ..and have it create a file of repeat offenders. ive tired to use comm to compare file1 against file2 doing something like comm -12i file1 file2 file3 however it doesnt seem to workany suggestions ? Are file1 and file2 sorted? -Chris ___ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: comparison of files
On Tue, 16 Dec 2003 16:38:15 -0500 (EST) Brent Bailey [EMAIL PROTECTED] wrote: yes sorted in numerical order by IP -- Brent Bailey CCNA Bmyster LLC Computer Networking and Webhosting Network Engineer, Webmaster, President http://www.bmyster.com [EMAIL PROTECTED] 207-247-8330 On Tue, 16 Dec 2003 16:31:22 -0500 (EST) Brent Bailey [EMAIL PROTECTED] wrote: hello, I have been trying to write a shell script that will compare 2 files and generate a 3rd. i have a list of abusive IP's generated by our router. I want to compare it against a list of known abuse IPs ..and have it create a file of repeat offenders. ive tired to use comm to compare file1 against file2 doing something like comm -12i file1 file2 file3 however it doesnt seem to workany suggestions ? Are file1 and file2 sorted? -Chris Sorry, it doesnt seem to work isn't a lot to go on. What output did you expect, and what output did you actually get? Have you tried different options to 'comm'? If the list contains only numeric IP addresses, the '-i' option isn't going to do you much good, for example. Have you tried 'diff file1 file2'? Do you get the output that seems reasonable from that? -Chris P.S. please keep [EMAIL PROTECTED] CC'ed, and please don't top-post. ___ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: comparison of files
Brent Bailey wrote: hello, I have been trying to write a shell script that will compare 2 files and generate a 3rd. i have a list of abusive IP's generated by our router. I want to compare it against a list of known abuse IPs ..and have it create a file of repeat offenders. ive tired to use comm to compare file1 against file2 doing something like comm -12i file1 file2 file3 however it doesnt seem to workany suggestions ? thank you for all your help in advance You need to sort the files first...see below for difference in comm behavior... Script started on Tue Dec 16 20:27:59 2003 freeb# cat blacklist1 192.168.1.2 192.168.1.1 192.168.1.10 freeb# cat blacklist2 192.168.1.1 192.168.1.10 freeb# comm -i12 blacklist1 blacklist2 freeb# sort blacklist1 blacklist1_sorted freeb# sort blacklist2 blacklist2_sorted freeb# comm -i12 blacklist1_sorted blacklist2_sorted 192.168.1.1 192.168.1.10 Script done on Tue Dec 16 20:29:14 2003 Scott ___ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]