comparing 2 lists

Discussion in 'Mac Apps and Mac App Store' started by caMi, Sep 17, 2007.

  1. caMi macrumors regular

    Joined:
    Sep 13, 2007
    #1
    Okay,

    I have 2 list of names (each have about 200-300 names)

    I want to compare the 2 lists to see what names appear on both lists.

    What application can do this for me?
     
  2. kiwi-in-uk macrumors 6502a

    Joined:
    Sep 22, 2004
    Location:
    AU
    #2
    Excel (vlookup) or Word (compare)

    Openoffice / Neooffice should have the same / similar functionality but I haven't looked.
     
  3. TemeculaMac macrumors regular

    Joined:
    Aug 8, 2007
    #3
    What format are the lists in? You could always go to a shell, and write a quick perl or bash script...or use cmp, diff, or sdiff.
     
  4. TemeculaMac macrumors regular

    Joined:
    Aug 8, 2007
    #4
    Okay...had a few minutes, so I threw a simple bash script together.

    Just put the following into a file named compare.sh, in the same directories as your 2 files:

    #!/bin/bash

    file1=$1
    file2=$2

    cat $file1 | while read i
    do
    grep -x "$i" $file2
    done

    Go to your terminal (bash shell), and cd into the directory where these files reside. Run it:

    sh compare.sh list1 list2

    (where list1 and list2 are the names of your files)

    It'll spit out the COMMON lines only.

    Gary
     

Share This Page