Seen on a mailing list today:
Hi. I’m trying to figure out if it is at all possible to compare two files, and then output the list of missing lines in one file to a separate file.
Say, I have two documents, each containing a long list of items. The names of the documents are Document FULL and Document PARTIAL. I sort both alphabetically and do a difference between them.
I’d like to capture the list of items (rows) that exist in Document FULL but don’t exist in Document PARTIAL. How would I go about this?
This looks like a newLISP one-liner. But I hate one-liners for their ugliness and forced nature. So here’s a multi-line version:
(print "in the first but not the second: "
(difference
(parse
(read-file
(string
(env "HOME" ) "/list1.txt" )) "\n" 0)
(parse
(read-file
(string
(env "HOME" ) "/list2.txt" )) "\n" 0)))
Leave a comment