lookfor matching strings between 2 files

Discussion in 'General Linux' started by papori, Jun 4, 2013.

  1. papori

    papori New Member

    Messages:
    7
    Likes Received:
    0
    Trophy Points:
    0
    Hi all,
    I have a basic procedure that i want to create..
    Assuming that I have 2 files.
    In each file i have list of 30 words.
    i want to lookfor the first word in list 1, if it found also in list 2.
    if it is, keep the line number in file.
    if not, keep the word in different file.
    Any idea on short/easy solution?


    Thanks,
    Pap
  2. nixsavy

    nixsavy Member

    Messages:
    65
    Likes Received:
    17
    Trophy Points:
    8
    I'm sure about what you want but for compare contents of two files you can use sdiff command as below:

    Code:
    sdiff file1 file2 

Share This Page