Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
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, row1 in file1 with column1, row1 in file2, then column2, row1 in file1 with column2, row1 in file2, and so on till the end of the two files. If there is any difference in the individual “item” in each row, my script should be able to print/write it to a file say file3.
file1Computers 2.84 49
Printers 1.56 65
Keyboard 1.52 22
Mouse 1.24 35
Webcam 3.99 74file2
Scanners 5.86 49
Printers 1.56 88
Keyboard 1.52 22
Plotters 3.28 56
TV Cards 6.24 67

so what should file 3 look like? I'm interpreting that you want to compare line 1 in file 1 with line 1 in file2 , line 2 with file 1 with line 2 in file 2, etc.
Please advise.

The file3 should list all the lines that match the comparison. I want to compare column1, row1 ( say computer) in file1 with column1, row1 ( scanners)in file2 and if they match i write line in file2 to file3 (I am comparing column wise, not the entire line of file1 to that of file2).

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |