LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 05-12-2010, 05:20 PM   #1
kadvar
LQ Newbie
 
Registered: Jul 2005
Distribution: Slackware
Posts: 11

Rep: Reputation: 0
Question remove duplicate entries from first column??


Hi I have a huge (over 10 gb) file with a list of IP's each followed by a corresponding number like this:

Code:
12.32.34.23  10
143.32.34.543  11
232.32.45.65  12
54.23.5.232  13
143.32.34.43  14
and so on..

I'm trying to sort this file numerically and weed out any duplicate IP addresses. How do I do this on bash? I have come up with this but obviously it does'nt work.

Code:
$sort -n myfile.txt | cut -f1 | uniq -u
Please remember that this needs to scale up to a huge file and my machine only has about 2 GB or RAM.

Thanks,
Adi
 
Old 05-12-2010, 05:34 PM   #2
kadvar
LQ Newbie
 
Registered: Jul 2005
Distribution: Slackware
Posts: 11

Original Poster
Rep: Reputation: 0
Nevermind, got my answer:

I did a:

Code:
sort -n -u -k1 myfile.txt
 
Old 05-12-2010, 06:22 PM   #3
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 10,005

Rep: Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191
Please mark as SOLVED once you have your answer.
 
  


Reply


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
How to find duplicate entries in shell jyotijain21 Linux - Newbie 5 06-23-2008 01:17 AM
removing duplicate entries shabev Linux - Enterprise 3 03-25-2008 10:36 AM
Duplicate entries in fstab jrdioko Linux - Software 3 08-14-2006 01:08 AM
duplicate entries in grub d_GeNeRiT Fedora 5 01-26-2006 07:22 AM
Duplicate Entries OpenSuSE 10.0 TMan459 SUSE / openSUSE 3 10-19-2005 04:43 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 04:20 AM.

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