I've got a plain text file called inputs.txt
with the following content:
some_array = {
"x" = "blabla1"
"y" = "blabla2"
"z" = "blabla3"
}
ip_addresses = {
"x" = "1.2.3.4"
"y" = "1.2.3.4"
"z" = "1.2.3.4"
}
names = {
"x" = "abc"
"y" = "def"
"z" = "ghi"
}
... and many more of the same type of arrays.
Now I need to use PowerShell to loop through the IP addresses in the object ip_addresses.
I'm not really coming any further than:
$file = Get-Content -Path ./inputs.txt
Which will return the entire file, but I just need the IP addresses. Prefereably comma seperated.
Is there an easy way to loop though this? It would have been easier if input.txt
were json files but they're not unfortunately. This is the structure and it can't be changed.
Thanks in advance for any help!