Cmp
CMP command: Compare any two types of files, and the results output to the standard output, the default file is the same output, different file output differences
Necessary parameters
-C Displays different information
-l list all the different information
-S error message does not prompt
Select parameters
-i< characters > specified number of characters
-V Display version information
--HELP Display Help information
"Return value of function"
0: The file is the same
1: The files are different
>1: Error occurred
Cases:
The code is as follows:
[Root@localhost www]# cmp test1.rb test.rb #比较二个文件的不同
TEST1.RB test.rb Differ:byte 1, line 1
[Root@localhost www]# cmp-l test1.rb test.rb #显示所有不同
1 160 162
2 165 145
3 164 161
4 163 165
5 40 151
6 42 162
7 150 145
8 145 40
9 153 42
10 153 155
11 153 171
12 42 163
13 12 161
Cmp:eof on TEST1.RB
Comm
Comm-Compare two sorted files on a line-by-row basis
Compare sorted files Left_file and Right_file line by row.
-1
Masks rows (or content) different from the right file in the left file (left_file)
-2
Mask the row (or content) in the right file (Right_file) that differs from the left file
-3
Mask the same line (or content) in two files
(The original is "not the same line", the suspect is wrong)
-L
The input data is considered to be sorted according to the current locale (the-l option should be given to sort).
--help
Display Help information, and then end
--version
Display version information, and then end
Cases:
The code is as follows:
[root@localhost www]# comm test.rb test1.rb #比较二个文件