From 459771a45a171897d4378b2e916cb0746eacb2fc Mon Sep 17 00:00:00 2001 From: Martin Czygan Date: Mon, 28 Dec 2015 14:04:58 +0100 Subject: [PATCH] add comm command --- pages/common/comm.md | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 pages/common/comm.md diff --git a/pages/common/comm.md b/pages/common/comm.md new file mode 100644 index 0000000000..1244d4bece --- /dev/null +++ b/pages/common/comm.md @@ -0,0 +1,23 @@ +# comm + +> Select or reject lines common to two files. Both files must be sorted. + +- 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, read one file from stdin. + +`cat {{file1}} | comm -12 - {{file2}}` + +- Print lines only found in first file. + +`comm -23 {{file1}} {{file2}}` + +- Print lines only found in second file. + +`comm -13 {{file1}} {{file2}}`