Reputation: 25
I need to get the second section of an IP address stored in a variable for comparison reasons.
$a = "10.20.0.0"
I need to get and store the 20 as a new variable.
Upvotes: 0
Views: 33
Reputation: 486
You can use Split to get what you need
$a.Split('.')[1]
This splits on the '.' and then you can access each section starting from 0.
Upvotes: 1