comm
comm
The comm
command in Linux is used to compare two sorted files and display the lines that are common, different, and unique to each file. It is a powerful tool that can be used to find differences between files, or to find common lines in two files.
The comm
command is used in the following syntax:
The file1
and file2
are the two files that you want to compare.
The options
can be used to specify the following:
-1
: Display the lines that are only in file1.-2
: Display the lines that are only in file2.-3
: Display the lines that are in both files.-u
: Display the lines that are unique to file1 and file2.
For example, the following code will compare the files file1.txt
and file2.txt
and display the lines that are common to both files:
This code will print the lines that are common to both files file1.txt
and file2.txt
to the standard output.
The comm
command is a powerful and versatile tool that can be used to compare two sorted files. It is a simple and easy-to-use command that can be used to find differences between files, or to find common lines in two files.
Here are some additional things to note about the comm
command:
The
comm
command can be used to compare any two sorted files.The
comm
command can be used to find differences between files.The
comm
command can be used to find common lines in two files.The
comm
command is a simple and easy-to-use command.
help
Last updated