The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Remove duplicate text dejavu88 Shell Programming and Scripting 7 06-08-2008 01:37 PM
duplicate line in a text file nixguy Shell Programming and Scripting 5 04-28-2008 11:19 PM
Duplicate records from oracle to text file. shilendrajadon UNIX for Advanced & Expert Users 1 01-10-2008 08:21 AM
Eleminating output to console pflink UNIX for Dummies Questions & Answers 3 02-26-2007 11:37 PM
grep multiple text files in folder into 1 text file? coppertone UNIX for Dummies Questions & Answers 7 08-23-2002 11:50 AM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 01-24-2008
Registered User
 

Join Date: Jan 2008
Posts: 44
Eleminating Duplicate IPs from a text file

Hey Guys
I need to eleminate duplicate IP's from a text file using bash.Any suggestions.Appreciate your help guys.

--CoolKid
Reply With Quote
Forum Sponsor
  #2  
Old 01-24-2008
Smiling Dragon's Avatar
Disorganised User
 
Join Date: Nov 2007
Location: New Zealand
Posts: 734
Lightbulb

Try sort -u
Reply With Quote
  #3  
Old 01-24-2008
Registered User
 

Join Date: Jan 2008
Posts: 44
Tried it..It is not working
Reply With Quote
  #4  
Old 01-24-2008
Registered User
 

Join Date: Feb 2007
Location: Pune, Dehradun (INDIA), Michigan(US)
Posts: 187
Quote:
Originally Posted by coolkid View Post
Hey Guys
I need to eleminate duplicate IP's from a text file using bash.Any suggestions.Appreciate your help guys.

--CoolKid
Hey,

uniq
This filter removes duplicate lines from a sorted file. It is often seen in a pipe coupled with sort.
cat list−1 list−2 list−3 | sort | uniq > final.list
# Concatenates the list files,
# sorts them,
# removes duplicate lines,
# and finally writes the result to an output file.

Try this logic, hope you'll get the desired one.

Thanks
Varun.
Reply With Quote
  #5  
Old 01-24-2008
Registered User
 

Join Date: Jan 2008
Posts: 44
Thanks for the help folks.
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 06:36 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0