Parsing text files with multiple results

What is the correct method for handing multiple results when creating an analysis? For example in my company we have a our Linux servers using a primary and backup dns server in the /etc/resolv.conf file. If I wanted to create an analysis to read that file using lines of file “/etc/resolv.conf”, I will receive multiple results since we have two nameserver lines in the file. I also tried a snippet that I found on another forum post that I edited to similar results.

“if exists file (”/etc/resolv.conf") then following texts of firsts “nameserver” of lines whose (it contains “nameserver”) of file (“/etc/resolv.conf”) else “n/a”

How would I be able to construct relevance to display each line instead of multiple results? Thank you all and hope to see some of you at Interconnect this year :slight_smile:

  1. Multiple results:

q: lines of file “c:\test1.txt”
A: this is line 1
A: this is line 2

  1. Single result:

q: concatenation ", " of ( lines of file “c:\test1.txt” )
A: this is line 1, this is line 2

Basically, you’ll just need to use “concatenation” (with a delimeter) around your relevance:

q: concatenation “; " of ( if exists file (”/etc/resolv.conf") then following texts of firsts “nameserver” of lines whose (it contains “nameserver”) of file (“/etc/resolv.conf”) else “n/a” )
A: 1.2.3.4; 5.6.7.8

2 Likes

Hi @vnovik,

That did the trick. Thank you!. I never fully understood when to use the concatenation until you pointed it out today.