Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Hi all,
the output of my nawk/sed script is leaving me with many repeated entries, ie:
entry1
entry1
entry2
entry2
...
There are not similarities on the entries, how can I eliminate all repeated entries, and leave only one occurence for each different entry?your help is greatly appreciated.

Hi:
Your output appears to be sorted. If that's the case why not send the output of your script to sort -u. (-u means unique).
You also might check out the uniq command.
Regards,
Nails

Nails has you on the right track, but I get the impression that some of the records are mostly similar but perhaps are not precise duplicates. Perhaps the same except for a datestamp which you wish to ignore in terms of uniqueness. If this is the case your explanation of the problem should have been more detailed.
Thus do I point you to:
man sortYou will there discover that you probably want to do something like:
cat datafile | sort -u -k 1,1 > outputwhich will send the data through the sort command, which will "key" in on only the first field, as delimited by white-space. Remember you must check the man pages for yourself, I am not familiar with Solaris, which may or may not have a different sort command.

![]() |
date in file name
|
Sco 5.05
|

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |