[nycbug-talk] Text parsing question

Jan Schaumann jschauma at netmeister.org
Mon Dec 15 20:46:02 EST 2008


"maddaemon at gmail.com" <maddaemon at gmail.com> wrote:
 
> Dec 15 05:15:56 - abc1234 tried logging in from 192.168.8.17
> Dec 15 05:15:56 - abc1234 tried logging in from 192.168.18.13

Split into timestamp, line and IP.  Use a hash:

if $line matched "abc1234 tried logging in from"
	if ! $line_by_ts{$timestamp}
		$line_by_ts{$timestamp} = $ip
	else
		if $ip != $line_by_ts{$timestamp}
			# dupe with different ip
		else
			# dupe with same ip
		endif
	endif
endif

awk or perl should do.

-Jan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 186 bytes
Desc: not available
URL: <https://lists.nycbug.org:8443/pipermail/talk/attachments/20081215/ce5c394b/attachment.bin>


More information about the talk mailing list