Categorizing by IP Range

Looking for help matching up an IP address in a file. I am doing this by range and for 90% of the devices this works fine. I will put up the line that seems to fail:

“{(((( line of it) whose ((preceding text of first “,” of it as version <= parameter “LOCALIP” as version) AND (preceding text of first “,” of (following text of first “,” of it) as Version >= parameter “LOCALIP” as version))) of file “c:\temp\list.txt” of (client folder of site whose (Name of it = “actionsite”))|“NOMATCH”))}”

Now the PARAMATER does get set (I check that before this line in the action and it will skip it if it is not valid).

Example of a run below:

image
And then I took the IP address of the devices that failed and put in the DEBUGGER (hard coding the IP address in question):

image

This should ONLY match that last line not the first one. To prove that I put this in debugger:

image
And yes I did this casting as VERSION as well (not shown above). I don’t get why 100’s of devices work fine and match their range in the file, while a HANDFUL seem to match multiple lines. I removed the last part (removing the AND statement which I thought maybe I messed up something)
AND (preceding text of first “,” of (following text of first “,” of it) as Version >= parameter “LOCALIP” as version
And as expected it MATCHES multiple lines as it only test for the START of the range, so to me it proves that my AND statement is programmatically correct.

It’s very hard for me to read screenshots, it helps a lot of you can copy & paste the text here.

But based on squinting at your first screenshot, I think the relevance is correct but you have a typo in the data file. The first line, that you didn’t expect to match is a much larger range 192.something through 198.something.

Funny was doing something similar - but let me see if I can put that in debugger (from your screen shot) -
( (lines of it) whose (((preceding text of first “,” of it) as version <= “192.168.166.252” as version) AND ((preceding text of first “,” of (following text of first “,” of it)) as version >= “192.168.166.252” as version))) of file “c:\temp\list.txt”

Hopefully I typed that correctly - I put in some examples of ranges and I think i have the ones you listed as well.

Running in debugger:
q: ( (lines of it) whose (((preceding text of first “,” of it) as version <= “192.168.166.252” as version) AND ((preceding text of first “,” of (following text of first “,” of it)) as version >= “192.168.166.252” as version))) of file “c:\temp\Mylist.txt”

A: 192.168.122.165,198.168.122.220,SeekList,FailoverList,US,NH,City
A: 192.168.166.250,192.168.166.254,SeekList,FailoverList,USA,NH,Here
T: 5.170 ms

Seems like it should NOT get two lines but only one:

192.168.166.250,192.168.166.254,SeekList,FailoverList,USA,NH,Here

Because the IP address you have IS greater then BOTH of the lines returned, but ONLY matches the second line as it is LESS then the 192.168.166.254, I wonder if something with the AND statement is off?

192.168.166.250 as version <= “192.168.166.252” as version >= 192.168.166.254 as version – This TRUE

192.168.122.165 as version <= “192.168.166.220” as version >= 192.168.166.254 as version – This FALSE because it should FAIL the second version test (passes the first “<=” but fails the “>=” or should).

You say this works on most other IP Ranges? As reading it it seems like it should.

1 Like

But the first line is a much larger range - includes 192.x, 193.x, 194.x, … all the way up to 198.168.122.220.

The tested address 192.168.166.252 does fall within the ranges of both of those lines.
I think it’s a data error on the first line, and instead of the range being

192.168.122.165,198.168.122.220

it’s probably intended to be

192.168.122.165,192.168.122.220

Ahhh GOOD CATCH. My eyes did not see the (I assume) typo. When I put in the debugger my fingers just type “192.168.”