I have a database which stores sequential versions of a text file. What I would like to do is allow the user to call up any two historical files (e.g version 1 And version 4) and compare them for differences:
- Spelling changes
- New words / new sentences / new paragraphs
- Moved paragraphs
- Etc
Basically an online GIT but for text files not code.
I figure JavaScript is probably the best approach and I presume that there must be an open source library but I simply cannot find one.
Any assistance appreciated.
If you are running under linux, you could install
diff
, save both files in temp files, then compare them using theshell_exec
command.For example
Look at
man diff
for an option that suits your needs.