Retrieving multiple lines from a text file

(imported topic written by SystemAdmin)

Greetings,

I am trying to do a lookup in a text file foreach of the interfaces on a device. The text file is just a translation of network address to building sepparated by tabs

BUILD1 10.10.10.0

BUILD2 10.10.20.0

BUILD3 10.10.30.0

I’m able to get the results I need with the following relevance if there is only one network. However, there may be multiple results returned from inspectio of the interfaces. It is just grabbing the first value returned and evaluating it.

(following text of first "%09" of lines whose (it starts with ((unique value of subnet addresses whose (it as string != "0.0.0.0") of ip interfaces whose (loopback of it = false) of network as string) as string )) of file ("C:\MNEMONIC.txt"))

if I change the code to look for all results

(following text of first "%09" of lines whose (it starts with ((subnet addresses whose (it as string != "0.0.0.0") of ip interfaces whose (loopback of it = false) of network as string) as string )) of file ("C:\MNEMONIC.txt"))

I get “A singular expression is required.”

Any ideas?

(imported comment written by Zakkus)

the " starts with " inspector only works with singular results, and doesn’t work with lists:

Q: “some string” starts with (“some”)

A: True

T: 0.043 ms

Q: “some string” starts with (“some”; “string”)

E: A singular expression is required.

“unique values” will take a list of identical values and compress it down to just the unique ones:

Q: unique values of (“a”;“a”;“b”)

A: a

A: b

So what is happening here, is that you have multiple subnet addresses being returned in that “whose” statement. Without the “unique values” bit to remove the duplicates, you hit that error.

-Zak

(imported comment written by SystemAdmin)

Thanks Zak,

So, this got me thinking of an alternate approach. I came up with this:

concatenation ";" of unique values of following texts of firsts "%09" of (lines of file "C:\MNEMONIC.txt") whose (exists (it, (subnet addresses whose (it as string != "0.0.0.0") of ip interfaces whose (loopback of it = false) of network as string)) whose (item 0 of it contains item 1 of it))

This seems to work well, however my consern is the amount of time it takes to run. is there anything I can do to make this more efficient?