I have a number of data collectors connected to a service. This service is provided by third parties and I do not have "admin" access to create the queries in my interest. The only way to know if these collectors are active is via a URL that returns me pure text with the IP addresses of the devices:
["/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 those, if you have a disconnected one, it looks bad to identify and I do not want to be tied to this task to verify) / p>
I was able to handle "file1" to stay this way (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 be lazy 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 file1 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
Thank you in advance.
I was able to solve with the tip of the friend @JJoao.
$join arquivo1 tabela2 > combinados
"join" requires that the files are ordered in ascending order. To do this use:
$cat arquivo |sort |uniq > arquivo1