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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Very simple 1

Status
Not open for further replies.

nrich239

Programmer
Jun 9, 2004
22
US
I'm looking for a command to comapre two files and pull out the duplicates.
I used to know it and I haven't been able to think of it all morning
I've looked at comm, diff, and uniq and they're not it.

Any one know of this?

Thanks,
Nate
 
comm or uniq should do the trick, provided the 2 files are sorted.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Sorry, I mis-worded that, what I meant to do was for it to show the duplicates.

I have 2 lists of server names we're testing and i think that we have the same server on both lists. What i need it to do is to pull out what shows up on both lists
 
Something like this ?
comm -12 /path/to/list1 /path/to/list2
Remember, the two lists must be sorted.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
man diff

Mike

"A foolproof method for sculpting an elephant: first, get a huge block of marble, then you chip away everything that doesn't look like an elephant.
 
Yet another way:
sort /path/to/list1 /path/to/list2 | uniq -d

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top