If you're more comfortable with Applescript you can run the shell script of @Lauri Ranta with the following AppleScript :
do shell script "grep -vxf master.txt today.txt > today2.txt; cat master.txt today2.txt > master2.txt"
If this isn't clear for you, I've done an AppleScript including the shell script of @Lauri Ranta.
Here's how to step by step build an AppleScript application that will merge today list to a master list without duplicates
. Paths to master & today lists are saved between launchs or asked if not found/defined
. After merge, today list is cleared
1. Open AppleScript Editor
2. Paste following code
-- Merge today list to a master list without duplicates
-- . Paths to master & today lists are saved between launchs or asked if not found/defined
-- . After merge, today list is cleared
-- Path to temporary items folder
property pathToTemp : POSIX path of (path to temporary items)
-- Paths to temporary files
property newAdds_temp : pathToTemp & "mergeLists_new_adds.tmp"
property mergedList_temp : pathToTemp & "mergeLists_merged_list.tmp"
-- Paths to lists
property masterFile : ""
property todayFile : ""
if (masterFile is "") or (not FileExists(masterFile)) then
set todayFile to ""
set masterFile to choose file with prompt "Select the master list :"
if (masterFile is false) then
set todayFile to ""
set masterFile to ""
if (todayFile is "") or (not FileExists(todayFile)) then
set todayFile to choose file with prompt "Select the list to add :"
if (todayFile is not false) then
-- Prepare the shell script :
set masterFile_posix to POSIX path of masterFile
set todayFile_posix to POSIX path of todayFile
-- . Save new adds to newAdds_temp
set shellScript to "grep -vxf " & masterFile_posix & " " & todayFile_posix & " > " & newAdds_temp & "; "
-- . Merge master list & new adds to mergedList_temp (and remove newAdds_temp file)
set shellScript to shellScript & "cat " & masterFile_posix & " " & newAdds_temp & " > " & mergedList_temp & "; unlink " & newAdds_temp & "; "
-- . Replace master list by merged mergedList_temp
set shellScript to shellScript & "mv -f " & mergedList_temp & " " & masterFile_posix & "; "
-- . And clean today file
set shellScript to shellScript & "echo \"\" > " & todayFile_posix
-- Execute the generated shell script
do shell script shellScript
-- And display a message
display dialog "Merge done."
-- This function is inspired from Philip Regan answer on :
tell application "System Events" to return (exists theFile)
3. Export as an application
File menu > Export > FileFormat : Application
4. Backup your lists !
5. Try the application you just created