Monday, 15 April 2013

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


I am trying to remove an IP address from the output of the AWS CLI command "output-tags". I am very new in PowerShell and I am struggling. This is the output of the AWS command in both "Text" and "Jason" formats.

If you can help me remove any of the IP addresses, then I would appreciate it very much. I am using "PowerHail 2" and Convertform-Jason is not available in this version. Let's just assume that I can not upgrade to PowerShell 3.

Text:

  Tags Nameserver i-xxxxxxxx Example 10.0.0.56  

JSON:

<"> Tag"

<{"resource type": "example", "resource ID": "i-xxxxxxxx", "value": "10.0.0.56", " Div class = "post-text" itemprop = "text">

You can use a regex, for example:

  [regex ] :: Match ($ awsoutput, "\ b \ d {1,3} \. \ D {1,3} \. \ D {1,3} \. \ D {1,3} \ b"). Value  

No comments:

Post a Comment