1
I have a series of data collectors connected to a service. This service is provided by third parties and I do not have "admin" access to create queries as my interest. The only way to know if these collectors are active is via a URL that returns me a plain text with the IP addresses of the equipment:
["/10.0.0.110","/10.0.0.119","/10.0.0.130","/10.0.0.114"/10.0.0.110","/10.0.0.119"]
This format is bad for the end user, often comes duplicate addresses, would need something more friendly (I have 20 of these, if you have a disconnected, it is bad to identify and do not want to be tied to this task of checking)
I was able to treat "archive1" to look like this (Single and sequential values)
10.0.0.110
10.0.0.113
10.0.0.119
10.0.0.130
However, as we know users tend to show a certain laziness to relate the numbers. I have a "table2" with the following data:
10.0.0.110 ---> coletor A
[...]
10.0.0.130 ---> coletor R
I would like some suggestion to compare the occurrences in archive1 and table2. The expected return would be something like:
10.0.0.110 --> coletor A
10.0.0.113 --> coletor D
10.0.0.119 --> coletor H
10.0.0.130 --> coletor R
Thanks in advance.
I managed to solve with the tip of friend @Jjoao.
$join arquivo1 tabela2 > combinados
"Join" requires the files to be ordered in ascending order. To do this use:
$cat arquivo |sort |uniq > arquivo1
I haven’t read it all, so I might be fooling myself. Have you tried to see the remote
diff
? To compare two files?– Jefferson Quesado
experiment
join file1 tabela2
supposing that both are ordered.– JJoao
@Jjoao, Thank you! It worked the way I needed it.
– Brian Carvalho
Could you please create an answer with the solution found? Leaving it in the question makes it erroneously unanswered. Thank you
– Alisio Meneses