comm
Select or reject lines common to two files. Both files must be sorted. More information: <https://www.gnu.org/software/coreutils/comm>.
Install
- All systems
-
curl cmd.cat/comm.sh
- Debian
-
apt-get install coreutils
- Ubuntu
-
apt-get install coreutils
- Alpine
-
apk add coreutils
- Arch Linux
-
pacman -S coreutils
- Kali Linux
-
apt-get install coreutils
- CentOS
-
yum install coreutils
- Fedora
-
dnf install coreutils
- Windows (WSL2)
-
sudo apt-get update
sudo apt-get install coreutils
- OS X
-
brew install coreutils
- Raspbian
-
apt-get install coreutils
- Dockerfile
- dockerfile.run/comm
- Docker
-
docker run cmd.cat/comm comm
powered by Commando
Select or reject lines common to two files. Both files must be sorted. More information: <https://www.gnu.org/software/coreutils/comm>.
-
Produce three tab-separated columns: lines only in first file, lines only in second file and common lines:
comm file1 file2
-
Print only lines common to both files:
comm -12 file1 file2
-
Print only lines common to both files, reading one file from `stdin`:
cat file1 | comm -12 - file2
-
Get lines only found in first file, saving the result to a third file:
comm -23 file1 file2 > file1_only
-
Print lines only found in second file, when the files aren't sorted:
comm -13 <(sort file1) <(sort file2)
© tl;dr; authors and contributors