Michael O'Keefe wrote:
James Keeline wrote:

--- Richard Ernst <[EMAIL PROTECTED]> wrote:

6/8/2006,8:24:25,VENUS,LAN,0AADAMS,Desktop,10.66.6.123,x86 Family 15
5/31/2006,9:14:42,JUPITER,LAN,0AADAMS,Desktop,10.66.6.123,x86 Family 15 Model 2 Stepping 7,2400 MHz,255 Mb 6/5/2006,10:40:25,JUPITER,LAN,0ACCTGXTRA-2K,Desktop,10.66.6.99,x86 Family 6 Model 7 Stepping 3,548 MHz,256 Mb 6/8/2006,9:14:49,VENUS,LAN,0ALADEN,Desktop,10.66.6.57,x86 Family 6 Model 8 Stepping 3,863 MHz,383 Mb 6/7/2006,9:06:00,VENUS,LAN,0ALADEN,Desktop,10.66.6.57,x86 Family 6 Model 8 Stepping 3,863 MHz,383 Mb
I looked at uniq, but I couldn't find a way to just compare a certain
field and ignore the rest.


Do you want to see the entire line or just the unique hostname value in the 5th field? If you
only wanted a list of the unique hostnames you could use awk:

cat input_file | awk -F',' '{ print $5; }' | sort | uniq
cat input_file | cut -d',' -f5 | sort | uniq

If you wanted to see the first line in the file for each of these hostnames then that might
require a bit more cleverness.

I'll be interested to see what other suggestions you receive.

sort -t, -k 5 | sed 's/,/ /g' | uniq -f4 -w13

I picked -w13 becoz it was the largest hostname in your sample.
Change to suit....

Want to contribute to OpenSource and become immortal !?!
Add a -t flag to uniq ! it only deals with whitespace separation, hence the sed :(


--
Michael O'Keefe                      |          [EMAIL PROTECTED]
Live on and Ride a 03 BMW F650GSDakar|          [EMAIL PROTECTED]      / |
I like less more or less less than   |Work:+1 858 845 3514        /  |
more. UNIX-live it,love it,fork() it |Fax :+1 858 845 2652       /_p_|
My views are MINE ALONE, blah, blah, |Home:+1 760 788 1296       \`O'|
blah, yackety yack - don't come back |Fax :+1 858                _/_\|_,

--
[email protected]
http://www.kernel-panic.org/cgi-bin/mailman/listinfo/kplug-newbie

Reply via email to