Hello,
I'm trying to come up with a formula that extracts the following:
(bold is info to be extracted. these are all the possible combos that it can appear.
A "name" is just text. "IP" is a IP address).
so an example of the first line would be:
access-list 95 extended permit tcp object-group File-Hosts host 1.1.1.1 any
an example of the second type would be:
access-list 95 extended permit tcp object-group Harrys-Group host 1.1.1.1 eq 4100
etc, etc, etc.
I don't know if it makes a difference, but the examples below are returned via a vlookup. Also, some lines might be blank.
I've figured out how to return the first and second value if it's an "IP"
=IFERROR(MID(B3,SEARCH("host",B3)+5,SEARCH(" ",B3,SEARCH("host",B3)+5)-(SEARCH("host",B3)+5)),"")
and the second value if it's an IP as well
=IFERROR(MID(B5, SEARCH("xx",SUBSTITUTE(B5,"host ","xx",(LEN(B5)-LEN(SUBSTITUTE(B5,"host ","")))/5),1)+5, SEARCH(" eq",B5,1)-SEARCH("xx",SUBSTITUTE(B5,"host ","xx",(LEN(B5)-LEN(SUBSTITUTE(B5,"host ","")))/5),1)-5),"")
and also the third value if it is preceeded by either "eq" or "range"
=IFERROR(MID(B5,FIND("eq ",B5,1)+3,10),IFERROR(MID(B5,FIND("range ",B5,1)+6,16),""))
but I'm unable to account for so many possibilities....
Any help is appreciated!
<tbody>
</tbody><colgroup><col><col><col><col><col><col><col><col><col></colgroup>
I'm trying to come up with a formula that extracts the following:
(bold is info to be extracted. these are all the possible combos that it can appear.
A "name" is just text. "IP" is a IP address).
so an example of the first line would be:
access-list 95 extended permit tcp object-group File-Hosts host 1.1.1.1 any
an example of the second type would be:
access-list 95 extended permit tcp object-group Harrys-Group host 1.1.1.1 eq 4100
etc, etc, etc.
I don't know if it makes a difference, but the examples below are returned via a vlookup. Also, some lines might be blank.
I've figured out how to return the first and second value if it's an "IP"
=IFERROR(MID(B3,SEARCH("host",B3)+5,SEARCH(" ",B3,SEARCH("host",B3)+5)-(SEARCH("host",B3)+5)),"")
and the second value if it's an IP as well
=IFERROR(MID(B5, SEARCH("xx",SUBSTITUTE(B5,"host ","xx",(LEN(B5)-LEN(SUBSTITUTE(B5,"host ","")))/5),1)+5, SEARCH(" eq",B5,1)-SEARCH("xx",SUBSTITUTE(B5,"host ","xx",(LEN(B5)-LEN(SUBSTITUTE(B5,"host ","")))/5),1)-5),"")
and also the third value if it is preceeded by either "eq" or "range"
=IFERROR(MID(B5,FIND("eq ",B5,1)+3,10),IFERROR(MID(B5,FIND("range ",B5,1)+6,16),""))
but I'm unable to account for so many possibilities....
Any help is appreciated!
text | first value | text | second value | text | third value | |||
object-group | name | host | ip | any | equals first value | equals second value | equals thrid value | |
object-group | name | host | ip | eq | characters | equals first value | equals second value | equals thrid value |
object-group | name | host | ip | range | characters | equals first value | equals second value | equals thrid value |
object-group | name | host | ip | object-group | name | equals first value | equals second value | equals thrid value |
object-group | name | object-group | name | any | equals first value | equals second value | equals thrid value | |
object-group | name | object-group | name | eq | characters | equals first value | equals second value | equals thrid value |
object-group | name | object-group | name | range | characters | equals first value | equals second value | equals thrid value |
object-group | name | object-group | name | object-group | name | equals first value | equals second value | equals thrid value |
host | ip | host | ip | any | equals first value | equals second value | equals thrid value | |
host | ip | host | ip | eq | characters | equals first value | equals second value | equals thrid value |
host | ip | host | ip | range | characters | equals first value | equals second value | equals thrid value |
host | ip | host | ip | object-group | name | equals first value | equals second value | equals thrid value |
host | ip | object-group | name | any | equals first value | equals second value | equals thrid value | |
host | ip | object-group | name | eq | characters | equals first value | equals second value | equals thrid value |
host | ip | object-group | name | range | characters | equals first value | equals second value | equals thrid value |
host | ip | object-group | name | object-group | name | equals first value | equals second value | equals thrid value |
<tbody>
</tbody><colgroup><col><col><col><col><col><col><col><col><col></colgroup>
Last edited: