In Linux I use this for select specific line:
ip a | sed -n '3p' | xargs
But I don't know how can I make it in Powershell.
As Smorkster mentioned, powershell works in objects.
you can use dot notation as shown here to access a property of an object and then use indexing
(Get-NetIPAddress).ipaddress[3]
Powershell works (almost exclusively) in objects. That way you can use indexing to get a certain value/output. So you can do
( Get-NetIPAddress ).ToString()[3]
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.