Compare Files With Comm Command In Linux

RSS
EMAIL
FACEBOOK
FACEBOOK
GOOGLE
GOOGLE
https://www.poftut.com/compare-files-comm-command-linux/
PINTEREST
PINTEREST
INSTAGRAM

Linux have a lot of tools to compare files. These tools provides a lot of powerful features to meet user needs. But sometimes just simple comparison is enough for some users. comm is a tool for this purpose . Comm only compare files and shows differences in a visual manner.

Syntax

Help

Help

Help

Compare

We will simply compare two files those have same and different lines. We just need to provide file names to the comm command. Here is our files.

a.txt

b.txt

Now we issue the command like below.

Compare

Compare

As we can see the differences ok and lemon are printed in required column.

Check Order

In previous example we see that there are some information about unsorted columns. comm command automatically checks the order of the provided text file. This can be disabled with --nocheck-order parameter.

Do Check Order

Do Check Order

Suppress Columns

Columns can be suppressed with the suppress feature. We just need to provide column number to suppress like -1 , -2 , -3

  •  -1              suppress column 1 (lines unique to FILE1)
  • -2              suppress column 2 (lines unique to FILE2)
  • -3              suppress column 3 (lines that appear in both files)

Suppress Columns

Suppress Columns

RSS
EMAIL
FACEBOOK
FACEBOOK
GOOGLE
GOOGLE
https://www.poftut.com/compare-files-comm-command-linux/
PINTEREST
PINTEREST
INSTAGRAM

LEARN MORE  How To Flush DNS For Windows and Linux Operating Systems

You may also like...

Leave a Reply

Your email address will not be published.

Enjoy this blog? Please spread the word :)