From d95b01fcd1d1ed9d24de82ccf3c5820f5896734f Mon Sep 17 00:00:00 2001 From: Waldir Pimenta Date: Mon, 9 May 2016 14:17:43 +0100 Subject: [PATCH] make the last examples more useful (#858) Output to file and sort files. --- pages/common/comm.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pages/common/comm.md b/pages/common/comm.md index 26d0c0a831..0b84459cf8 100644 --- a/pages/common/comm.md +++ b/pages/common/comm.md @@ -10,14 +10,14 @@ `comm -12 {{file1}} {{file2}}` -- Print only lines common to both files, read one file from stdin: +- Print only lines common to both files, reading one file from stdin: `cat {{file1}} | comm -12 - {{file2}}` -- Print lines only found in first file: +- Get lines only found in first file, saving the result to a third file: -`comm -23 {{file1}} {{file2}}` +`comm -23 {{file1}} {{file2}} > file1-only.txt` -- Print lines only found in second file: +- Print lines only found in second file, when the files aren't sorted: -`comm -13 {{file1}} {{file2}}` +`comm -13 <(sort {{file1}}) <(sort {{file2}})`