REBOL [
Title: "Diff compare"
Date: 20-Jul-1999
Author: "Bohdan Lechnowsky"
File: %diff.r
Email: bo@rebol.com
Purpose: {
See the differences between two files.
Only provides basic DIFF functionality.
Shows lines which don't exist in other file.
}
Category: [file util 3]
]
diff: func [
"Compares two files for differences"
file1 [file!]
file2 [file!]
/local f-1 f-2
][
foreach [f file][f-1 file1 f-2 file2][
if not exists? get file [print [file "not found"] exit]
set f read/lines get file
]
foreach [block1 block2 name1] reduce [f-1 f-2 file2 f-2 f-1 file2][
print ["*****" name1 "*****" newline
"Lines which are not present in the other." newline
"-------------------------------------"]
forall block1 [
if none? find block2 first block1 [
print [index? block1 ":" first block1]
]
]
]
]