brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: comm -23 lists lines only in one file, a terminal set difference

Terminal
~/tips/tip-terminal-comm-23-set-difference

comm -23 <(sort old.txt) <(sort new.txt)

Prints the lines that exist in the first sorted file but not in the second.

Comparing two lists of names is simpler with comm than with a loop.

comm -23 <(sort old.txt) <(sort new.txt)

comm needs sorted input and prints three columns: lines only in the first file, only in the second and in both. -23 hides columns two and three, so you get lines that are only in the first file. -12 gives the lines both files share. If the files are not sorted the same way, the result is wrong, so sort inside the command as shown.

Further reading: comm manual page

More Terminal tips ioreg -rn AppleSmartBattery | grep CycleCount Terminal can save your windows and tabs as a window group Export a Terminal profile to a .terminal file and import it on another Mac mc hidutil property --set '{"UserKeyMapping":[{"HIDKeyboardModifierMappingSrc":0x700000039,"HIDKeyboardModifierMappingDst":0x700000029}]}' All Terminal tips (116) All topics

Link