Im extracting a list of IPs from a JSON file using the following syntax
$Request = 'https://url-to-json.com/file.json'
$AWSIPs = Invoke-WebRequest $Request | ConvertFrom-Json | Select-Object prefix -ExpandProperty prefixes -ExcludeProperty ("/.*") | Where-Object -Property "service" -EQ "service_name" | select ip_prefix
foreach ($awsip in $AWSIPs){
echo $awsip
}
This returns a list of IPs in this manner: - 0.0.0.0/00
- 0.0.0.0/00
- 0.0.0.0/00
- 0.0.0.0/00
- 0.0.0.0/00
- 0.0.0.0/00
I need to use this list of IPs, however before I can do so I need to remove the /00 at the end (obviously that's not 00 but it's the subnet mask, which is rarely ever identical).
I'd greatly appreciate help with this.
Thanks.