Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 01-12-2006, 03:44 PM   #1
LQ Newbie
Registered: May 2005
Posts: 15

Rep: Reputation: 0
shell script question: removing a line according to a duplicate "field"


I am sorting my web logs with a shell script (they're not apache )
I want to only track unique visitors. So I have sorted my logs according to the first field, which is IP address.
Great. Now I want to throw out "duplicate" users. I need advice on how to do this. I know uniq will do this if *the whole line is the same.* But i want to throw a line out only if the first field/ column is the same. The rest of the line can be "unique."

thanks you,
Old 01-12-2006, 03:57 PM   #2
LQ Guru
Registered: Dec 2005
Location: Somewhere on the String
Distribution: Debian Wheezy (x86)
Posts: 6,094

Rep: Reputation: 269Reputation: 269Reputation: 269
Try this one using awk:


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
bash script: using "select" to show multi-word options? (like "option 1"/"o zidane_tribal Programming 6 03-21-2013 10:35 AM
Shell Script: Find "Word" Run "Command" granatica Linux - Software 5 07-25-2007 07:42 AM
Starting Java from shell script (Exception in thread "main") rolf_mueller Linux - Software 5 10-30-2004 02:11 AM
1. shell script "find and replace" on text 2. java GUI application randomx Programming 4 03-05-2004 01:01 PM
Can I redirect script output to a file without ">> $LOGFILE" at the end of each line davee Linux - General 1 12-19-2003 05:01 AM

All times are GMT -5. The time now is 01:35 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration