Due to recent updates, all users are required to create an Altair One account to login to the RapidMiner community. Click the Register button to create your account using the same email that you have previously used to login to the RapidMiner community. This will ensure that any previously created content will be synced to your Altair One account. Once you login, you will be asked to provide a username that identifies you to other Community users. Email us at Community with questions.
"[SOLVED] How to compare text files for equality"
tennenrishin
Member Posts: 177 Contributor II
I need to conditionally execute some operators in the event that there is a difference between the file contents of two files (s.txt and last_s.txt), which contain 2 csv fields (namely a regex and a comment) separated by ';'.
If the files contain multiple lines, the only solution I can think of involves looping and comparing each line one-by-one, maintaining a boolean macro along the way. Does anyone have a better idea to compare a whole text file? (Perhaps an easy way to obtain/construct some kind of file hash?)
If the files contain multiple lines, the only solution I can think of involves looping and comparing each line one-by-one, maintaining a boolean macro along the way. Does anyone have a better idea to compare a whole text file? (Perhaps an easy way to obtain/construct some kind of file hash?)
Tagged:
0
Answers
you can use the text extension for this: read the two files as documents, then use Documents to Data to store the complete documents, i.e. the contents of the files, in a single attribute: each row now contains an example with the complete document. For easier comparison, transpose the example set, then use Generate Attributes for comparison.
Please have a look at the attached process, and replace the Create Document operators with Read Document.
Best, Marius