Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Multiple occurences of a number...

Status
Not open for further replies.

iceman4000000

Programmer
Jun 7, 2001
30
GB
Hi everyone... imagine a file which contains a column. In this one column, there are hundreds of rows containing a number - so it looks like a column extracted from an excel spreadsheet. Some of the numbers appear several times. I have sorted the column into numerical order. Does anyone know how I can get rid of the multiple occurences of numbers, so that every number in the file is unique? I'd much appreciate it...
 
If I understand correctly, sort -u filename should work.

If the file is already sorted, you could also use uniq infile outfile.

Greg.
 
Use
Code:
uniq file > newfile
Hope this helps. CaKiwi
 
Thanks guys - that was exactly what I needed.... worked like a charm
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top