Compare Fields in two Files

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • pravada
    New Member
    • Jul 2008
    • 3

    Compare Fields in two Files

    Can anyone help me with shell script to this problem.

    I have two files as shown below. I want to loop through the two files by comparing column1 in file1 with column1, then column2 and so on till the end in file2 with in file2. If that is found write that individual file to a third file say file3. so at the end the file 3 should contain the difference of both files.

    file1

    Computers 2.84 49
    Printers 1.56 65
    Keyboard 1.52 22
    Mouse 1.24 35
    Webcam 3.99 74

    file2

    Scanners 5.86 49
    Printers 1.56 88
    Keyboard 1.52 22
    Plotters 3.28 56
    TV Cards 6.24 67

    file 3
    Computers 2.84 49
    Mouse 1.24 35
    Plotters 3.28 56
    Webcam 3.99 74
    TV Cards 6.24 67
    thanks in advance.
  • gpraghuram
    Recognized Expert Top Contributor
    • Mar 2007
    • 1275

    #2
    You can achieve this using AWK.
    If you can use AWK and have some diea try using AWK for this.


    Raghu

    Comment

    • pravada
      New Member
      • Jul 2008
      • 3

      #3
      thanks a lot ....

      Comment

      Working...