4 ms·
One of my favorite moreutils tools is combine[1]. It allows you to compare the contents of text files with boolean operations. For example, want to know what li
by discreditable 9y ago
One of my favorite moreutils tools is combine[1]. It allows you to compare the contents of text files with boolean operations. For example, want to know what lines are in file1 but not file2? Use:
combine file1 not file2
1. http://manpages.ubuntu.com/manpages/zesty/en/man1/combine.1.html http://manpages.ubuntu.com/manpages/zesty/en/man1/combine.1....
- bbrazil 9y agoYou can use comm from coreutils for that too: `comm -1 file1 file2`
- Aissen 9y agoYep, but you'll have to read the man everytime to figure out if you need -1, -2 or -3, or a combination of those. combine gives you a better interface with boolean operators you know.
- xkxx 9y agoThe 1st column is the lines unique to the 1st file, the 2nd column is the lines unique to the 2nd file, and the 3rd one is the lines that are not unique. -1, -2, -3 allow to disable those columns. Pretty easy to remember. Ah, HN downvoting neutral comments again and I don't like it, but I have a policy of not upvoting anything out of pity.
- Aissen 9y agoAhaha, then I guess I don't use it that often. I'll try to remember this mnemonic. PS: do not worry about karma ^^
- discreditable 9y agoThe comm manpage[1] says that the files have to be sorted. In combine, they do not. 1. http://manpages.ubuntu.com/manpages/zesty/en/man1/comm.1.html http://manpages.ubuntu.com/manpages/zesty/en/man1/comm.1.htm...