PowerShell script to extract IP addressees from a file (i.e. log file) and count the number of occurrences of each IP address.
- Detects IPv4 only
- IP address matching is done through regex
- Not perfect but a quick an easy approach
ExtractIPaddressesAndCount
Parameter | Description |
---|---|
-InputFile | Input file such as a log file that contains IP addresses |
-OutputFile | File to write with the list of IPs and occurrences |
Import-Module ./Extract-IP-Addresses-and-Count.ps1
ExtractIPaddressesAndCount -InputFile "C:\Downloads\access.log" -OutputFile "C:\Downloads\Output.log"