$cidr = '192.168.10.0/24'
# split the network ip on '.', select the first 3 items in the result object and join them back together with a '.' delimiter
$First3Octets = ($cidr -split [regex]::Escape('.') | Select-Object -First 3) -join '.'
Also, for future posts, it helps when you format the code in your post. Makes it easier to read.
Viewing 1 reply thread
The topic ‘manipulating a line (IP) of a CSV to only use first 3 octets’ is closed to new replies.