Si está más cómodo con Applescript, puede ejecutar el script de shell de @Lauri Ranta con el siguiente AppleScript:
do shell script "grep -vxf master.txt today.txt > today2.txt; cat master.txt today2.txt > master2.txt"
Si esto no está claro para ti, he hecho un AppleScript que incluye el script de shell de @Lauri Ranta.
Aquí se explica cómo construir una aplicación AppleScript que fusionará la lista de hoy a una lista maestra sin duplicados.
. Rutas para dominar y amp; las listas de hoy se guardan entre lanzamientos o se preguntan si no se encuentran / definidas
. Después de fusionar, la lista de hoy se borra
1. Abre el editor de AppleScript
2. Pegue el siguiente código
-- 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 :"
end if
if (masterFile is false) then
set todayFile to ""
set masterFile to ""
else
if (todayFile is "") or (not FileExists(todayFile)) then
set todayFile to choose file with prompt "Select the list to add :"
end if
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."
end if
end if
-- This function is inspired from Philip Regan answer on :
-- http://stackoverflow.com/questions/3469389/applescript-testing-for-file-existence
on FileExists(theFile)
tell application "System Events" to return (exists theFile)
end FileExists
3. Exportar como una aplicación
Menú de archivo > Exportar > FileFormat: Aplicación
4. Copia de seguridad de sus listas!
5. Prueba la aplicación que acabas de crear