Hi,
I've written this script to find IP addresses inside a text file - it uses Regex
$input_path = ‘2013-06-19-SyslogCatchAll.txt’
$output_file = ‘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 } > $output_file
The reason I needed to use Regex was because the IP address is surrounded by other text and it's not just in 1 column. This works fine
Also in the text file in colum 1 is a time\date. Is there a way to say, foir each instance of the IP address return the column 1 data which is in the same row as the IP address?
Thanks
Alter De Ruine