I do not know if it is possible to compare the contents of text files among other files in a second folder. I need the program to only search for matching strings and if it finds them, show both lines of the files with the matching string.
I have tried with diff but I do not get the result I expect.
An example of what I'm looking for is:
Assuming I have two folders and within each one are the text files I want to compare.
Folder1/test.txt:
example1 - A exampleA - A example2 - B exampleB - C example3 - C exampleC - D
Folder2/test_different_name.txt:
exampleA - A example3 - B exampleB - C exampleC - D example1 - E
The result should be the matching strings of the compared files:
I added this bit as the formatting would not fit in a comment. If this is not the desired result, please delete it from the question! CharlesGreen
|==========================|
|String |File 1 |File 2 |
|--------------------------|
|example1 |A |E |
|example3 |C |B |
|==========================|
Note that only the matching texts are printed and when the entire line does not match, the differences are printed on the screen.