amazon web services - Powershell: Extract IP from AWS Output -


i'm trying extract ip address output of aws cli command "describe-tags". i'm new powershell , have been struggling. output of aws command in both "text" , "json" formats.

if can me extract ip address either of these formats, i'd appreciate it. i'm using "powershell 2" , convertfrom-json isn't available in version. let's assume can't upgrade powershell 3.

text:

tags    nameserver      i-xxxxxxxx      instance        10.0.0.56 

json:

{     "tags": [         {             "resourcetype": "instance",             "resourceid": "i-xxxxxxxx",             "value": "10.0.0.56",             "key": "nameserver"         }     ] } 

thanks lot!

you use regex, example :

[regex]::match($awsoutput,"\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b").value  

Comments

Popular posts from this blog

node.js - Mongoose: Cast to ObjectId failed for value on newly created object after setting the value -

[C++][SFML 2.2] Strange Performance Issues - Moving Mouse Lowers CPU Usage -

ios - Possible to get UIButton sizeThatFits to work? -