Last active
November 2, 2016 20:33
-
-
Save joli80/5e9d41e299f52872c243de868bd7d5fb to your computer and use it in GitHub Desktop.
Extract IP all addresses from a text file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Credit to http://www.gfi.com/blog/windows-powershell-extracting-strings-using-regular-expressions/ | |
$input_path = 'c:\ps\ip_addresses.txt' | |
$regex = '\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b' | |
select-string -Path $input_path -Pattern $regex -AllMatches | % { $_.Matches } | % { $_.Value } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment