I'm trying to write a perl one-liner to return the unique IP addresses from a Apache web log, like this:
perl -ne 'print if s/^(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}) .*/$1/' access.log | nawk '!x[$0]++' I tried to combine it with this script to count unique entries without sorting (which I learned from this list. Thanks!): perl -ne 'print unless $seen{$_}++;' I tried to combine them into this: perl -ne 'print unless $seen{s/^(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}) .*/$1/}++' access.log but it just returns the first entry of the file. I can do it like this, but this offends me: perl -ne 'print if s/^(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}) .*/$1/' access.log | perl -ne 'print unless $seen{$_}++;' Any advice on correcting my script? Thanks in advance for your suggestions. -Kevin ======================================== Kevin Zembower Internet Services Group manager Center for Communication Programs Bloomberg School of Public Health Johns Hopkins University 111 Market Place, Suite 310 Baltimore, Maryland 21202 410-659-6139 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>