Getting IP Addresses from a .log file?

Gigabyte P55a-ud3 motherboard - intel p5...
August 3, 2010 at 05:10:43
Specs: Windows 7, Core i5-750/4GB
I need a batch file that is able to grab IP Addreses (without the port numbers) from a log file and then store them inside Ip.txt AND also be able to delete the duplcaite ones too. I need it to also run in loops!

Here is a sample of the log file.

<b>
2010-08-01 00:07:57 - Program: INFO: Starting server...
2010-08-01 00:07:57 - IPServer: INFO: Starting IPServer
2010-08-01 00:07:57 - LogServer: INFO: Starting LogServer
2010-08-01 00:07:57 - MatchServer: INFO: Starting MatchServer for playlist 1
2010-08-01 00:07:57 - MatchServer: INFO: Starting MatchServer for playlist 2
2010-08-01 00:07:57 - MatchServer: INFO: Starting MatchServer for playlist 3
2010-08-01 00:07:57 - MatchServer: INFO: Starting MatchServer for playlist 4
2010-08-01 00:07:57 - MatchServer: INFO: Starting MatchServer for playlist 5
2010-08-01 00:07:57 - CSHTTPServer: INFO: Starting HttpHandler
2010-08-01 00:07:59 - HttpHandler: DEBUG: HTTP request for
2010-08-01 00:08:07 - IPServer: DEBUG: Handling IP request from 011000011E4076D9
2010-08-01 00:08:07 - UdpServer: DEBUG: Received packet at IPServer from 114.76.65.170:28960
2010-08-01 00:08:07 - UdpServer: DEBUG: Received packet at IPServer from 114.76.65.170:28960
2010-08-01 00:08:08 - UdpServer: DEBUG: Received packet at LogServer from 114.76.65.170:63865
2010-08-01 00:08:11 - UdpServer: DEBUG: Received packet at IPServer from 114.76.65.170:28960
2010-08-01 00:08:17 - UdpServer: DEBUG: Received packet at IPServer from 114.76.65.170:28960
2010-08-01 00:08:25 - UdpServer: DEBUG: Received packet at IPServer from 114.76.65.170:28960
2010-08-01 00:08:37 - UdpServer: DEBUG: Received packet at IPServer from 114.76.65.170:28960
2010-08-01 00:08:57 - UdpServer: DEBUG: Received packet at IPServer from 114.76.65.170:28960
2010-08-01 00:09:33 - UdpServer: DEBUG: Received packet at IPServer from 114.76.65.170:28960


See More: Getting IP Addresses from a .log file?

Report •


#1
August 3, 2010 at 18:40:15
Uhm, I'm not sure if this works for you, maybe somebody will be able to expand on it.

@ECHO OFF
SETLOCAL EnableDelayedExpansion

FOR /f "skip=11 tokens=11 delims= " %%a IN (test2.txt) DO (
	ECHO %%a
)
PAUSE

Hope I've been able to help somewhat!


Report •
Related Solutions


Ask Question