Substrings Data Loop

I have this relevance:

Q:
if substring(0, 2) of preceding texts of firsts “.” of line of file “c:\temp\tillinfo2.txt” is equal to (last 2 of hostname) then substring(0, 12) of following texts of firsts “.” of line of file “c:\temp\tillinfo2.txt” else NA

Text Data: 01.WN_TH230_USB,02.WN_TH210_USB,03.WN_TH240_USB,04.WN_TH200_COM…
Host Name: PNS999-01,PNS999-02,PNS999-03…

A:WN_TH230_USB

The problem is i have 40 PC need to do the matching with this relevance, how can i make a loop for this?

For example(failed):
if substring(0, 2) of preceding texts of firsts “.” of line of file “c:\temp\tillinfo2.txt” is equal to (last 2 of hostname) then substring(0, 12) of following texts of firsts “.” of line of file “c:\temp\tillinfo2.txt” else
if substring(0, 2) of preceding texts of seconds “.” of line of file “c:\temp\tillinfo2.txt” is equal to (last 2 of hostname) then substring(0, 12) of following texts of seconds “.” of line of file “c:\temp\tillinfo2.txt” else NA
…to 40

Many thanks!

Ivan

That…sounds like a challenge…

(This one, specifically… Relevance Challenge April 2018)

What I think you need is to split the lines on “.” and then examine the preceding and following texts.