Linux Console Programming - Contain Compare

Discussion in 'Programming' started by Magritus, Apr 2, 2012.

  1. #1
    I have a problem about comparing..

    File1.txt
    File2.txt
    I want to this output
    How can i do this?? Diff, Comm or grep i think not supporting contain.. I need contain compare..
     
    Magritus, Apr 2, 2012 IP
  2. Magritus

    Magritus Active Member

    Messages:
    21
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    53
    #2
    hi again..
    i resolved my problem with this bash script..


    Firstly i convert dos to unix with this command.
    cat file2.txt | tr -d "\r" > file2.txt
    Code (markup):
    and than i use this bash script file..
    for i in $(cat file2.txt); do
    grep -r $i file1path/* | uniq | while read f; do echo $f; done
    done;
    
    Code (markup):
     
    Magritus, Apr 3, 2012 IP