from small one page howto to huge articles all in one place
Last additions: May, 25th 2007: April, 26th 2007: Apr, 10th. 2007: |
. You are here: Tips&Tricks
Comparing FilesOften people compare the differences between two files using diff. But if you needed to do a comparison of similarities between files, comm is the command to use. Code Listing 1: comm usage syntax comm [option] file1 file2 Note: both file1 and file2 need to be sorted before using comm as it does a line by line comparison. comm outputs three columns: lines that are unique to file1, lines that are unique to file2, and lines that are common to both files. The options '-1', '-2', '-3' will suppress the corresponding columns. Running comm -2 file1 file2 with the following files, would output five. Code Listing 2: comm output File1:
one
two
three
File2:
one
five
three From http://www.gentoo.org/news/en/gwn/20040823-newsletter.xml
rate this article: current rating: no votes yet Your rating:
back
|