Ive got another querie though. Im not sure how to say - if several elements are all the same, and theres another line that has the exact same except one specific feild, deleate that line.
In other words take a look at my data:
access-list 1 permit tcp 192.168.1.2 0.0.0.0 168.111.2.1 255.255.255.0 = 23
access-list 2 deny udp 0.0.0.0 255.255.255.255 0.0.0.0 255.255.255.255 = 23
access-list 3 permit ospf 192.168.2.3 255.255.255.0 0.0.0.0 255.255.255.255 = 179
acess-list 2 deny ospf 192.168.2.3 255.255.255.0 0.0.0.0 255.255.255.255 = 179
access-lst 3 permit 0.0.0.0 255.255.255.255 0.0.0.0 255.255.255.255 = 21
access-list 5 permit 192.168.0.1 255.255.255.0 0.0.0.0 255.255.255.255 = any
access-list 14 deny 191.168.0.1 255.255.0.0 0.0.0.0 255.255.255.255 = any
access-list 443 permit 192.163.0.1 255.255.0.0 0.0.0.0 255.255.255.255 = any
access-list 77 permit 192.168.0.1 255.255.255.0 0.0.0.0 255.255.255.255 = any
access-list 5 deny 192.168.34.4 255.255.255.0 0.0.0.0 255.255.255.255 = any
access-list 5 permit 192.168.0.1 255.255.255.0 0.0.0.0 255.255.255.255 = any
access-list 2 permit 192.168.1.13 255.0.0.0 0.0.0.0 255.255.255.255 = any
access-list 77 deny 192.168.0.1 255.255.0.0 0.0.0.0 255.255.255.255 = any
access-list 88 permit 192.168.0.1 255.255.255.0 0.0.0.0 255.255.255.255 = any
access-list 1 deny 192.168.0.2 255.255.255.0 0.0.0.0 255.255.255.255 = any
access-list 2 permit 192.168.0.4 255.255.255.0 0.0.0.0 255.255.255.255 = any
Taking into consideration that [2] can be only permit or deny:
Im trying to say if all the elements of each line were the exact same, apart from [2] The permit or deny element, then delete the lines that have opposing [2] rules. In other words if I had:
access-list 1 permit 192.168.1.1 0.0.0.1 ...ect
access-list 1 deny 192.168.1.1 0.0.0.1 ...ect
access-list 1 permit 192.168.1.1 0.0.0.1 ...ect
access-list 1 permit 192.163.1.1 0.0.0.1 ...ect
access-list 1 deny 192.168.1.1 0.0.0.1 ...ect
access-list 1 deny 192.168.1.1 0.0.0.1 ...ect
access-list 1 permit 111.162.1.1 0.0.0.1 ...ect
access-list 1 permit 195.168.4.1 0.0.0.1 ...ect
Then by looking at the first rule and saying:
For any line where:
access-list 1 192.168.1.1 0.0.0.1
was the same and only the permit feild is changed delete it and display the new file. Which would probebly look like this.
access-list 1 permit 192.168.1.1 0.0.0.1 ...ect
access-list 1 permit 192.168.1.1 0.0.0.1 ...ect
access-list 1 permit 192.163.1.1 0.0.0.1 ...ect
access-list 1 permit 111.162.1.1 0.0.0.1 ...ect
access-list 1 permit 195.168.4.1 0.0.0.1 ...ect
in other words if the rules is
access-list 1 permit 192.168.1.1 0.0.0.1
deleat all other rulles that look like this:
access-list 1 deny 192.168.1.1 0.0.0.1
I have a rule that deals with exact copys and would like to keep them differant so now im just trying to delete conflicting permit/deny feilds.
I know this is pretty complicated so any help as to how it would be done would be excellent.
Thanks in advance.