mirror of
https://github.com/tldr-pages/tldr.git
synced 2024-11-10 11:29:59 +03:00
3da76e4150
* Applying the snake_case convention throughout the repo - Also removing the file extension where not needed - Adding {{ }} on a few old pages * Addressing concerns - Added {{ }} where they were missed out - Removed spaces inside {{ }} - Reverting "file" to "filename" to make it clearer * Fixing the comments on nc page
647 B
647 B
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, 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}})