I have to iterate over a large loop of IPs and I have been able to do this with ease in bash, but while attempting to do this in PowerShell I found that I have little idea how to do something similar.
In bash I have done the following:
for ip in 10.98.{7..65}.{0..255}; do
echo "some text and a $ip";
done
However, in PowerShell I have done the following:
$ipprefix='10.98';
For ($i=7; $i -le 65; $i++) {
For ($j=0; $j -le 255; $j++) {
Write-Host "some text and a $ipprefix.$i.$j";
}
}
Is there an easier way to do this in PowerShell?
glob. I have no idea whether PS globs are as powerful, but I think that's what you'd want to be googling, not "regex"