Adding only new text/simplifying lists
I'm trying to parse my /var/log/secure file so that I can close down my system with iptables after repeated incorrect logins. I can extract the correct IP address to a file, but the file (depending on the number of login attempts) lists the same address multiple times. Is there any way to either 1) only add a line of text to a file if that line of text isn't already present... or 2) parse a file with a list of IP addresses and come up with a list of each IP only one time? Or to put that another way:
aaa.bbb.ccc.ddd aaa.bbb.ccc.ddd aaa.bbb.ccc.ddd aaa.bbb.ccc.ddd aaa.bbb.ccc.ddd aaa.bbb.ccc.ddd eee.fff.ggg.hhh eee.fff.ggg.hhh eee.fff.ggg.hhh eee.fff.ggg.hhh [magic happens here] aaa.bbb.ccc.ddd eee.fff.ggg.hhh Thank you kindly. ink |
Just add a -u to the sort (that you're presumably
doing)... Cheers, Tink |
All times are GMT -5. The time now is 01:15 AM. |