I want to compare two text data with different columns and extract rows with differences.

Asked 1 years ago, Updated 1 years ago, 110 views

There are two files, A and B.

File A

 1,1234,4567,890,1
2,2345,5678,891,2
3,3456,6789,891,3

File B

 1,1234,4567,890
3,3456,6789,891

In this case, the

in file A.
 2,2345,5678,891,2

Is it possible to extract only and write it to another file?
By the way, there are about 10,000 lines of files.

File A is 5 columns, file B is 4 columns, and the last column of file A is not in file B
The difference extraction is based on a comparison between the first four columns of file A and the fourth columns of file B.

Thank you for your cooperation.

emeditor

2022-09-30 20:11

1 Answers

Remove the last column from file A, compare, and extract the modified row.For macros, activate file B, file A, and then run the following macros:After macro execution, be careful not to save the last column of file A as it has been deleted.

editor.ExecuteCommandByID (22528); // switch to CSV mode
document.selection.StartOfDocument(false);
document.selection.EndOfLine(false,eeLineView);
editor.ExecuteCommandByID (3962); // Delete Column
if(editor.Compare(0, "", "", "") == eDiff){
    editor.ExecuteCommandByID (4323); // Clear all Bookmarks
    editor.ExecuteCommandByID(4593); // Bookmark Changes
    editor.ExecuteCommandByID(4590); // Extract Bookmarked Lines to New File
    editor.ExecuteCommandByID (4497); // Reset Compare mode
}


2022-09-30 20:11

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.