"Linux command-File management class" CMP command

Source: Internet
Author: User

CMP (Compare) command

Command function: Compare the differences between two files
Command usage: CMP [-clsv][-i < number of characters >][–help][first file] [second file]

When the two files that are compared to each other are identical, the instruction does not display any information;
If found to be different, the preset will indicate the first difference in the character and column number;
If you do not specify any file name or the given file name is "-", the CMP instruction will read the data from the standard input device.

Command parameters:

  • -C or –print-chars displays the corresponding character of the character in addition to the decimal loadline that indicates the difference.
  • -i< number of characters > or –ignore-initial=< characters > Specify a number.
  • The-L or –verbose mark all the different places.
  • -S or –quiet or –silent do not display an error message.
  • -V or –version displays version information.
  • Help online Help.

Example:

First prepare two files file1 and File2,

1. Compare File1 and File2:

Without parameters, the CMP instruction compares the first two file differences and outputs the first few bytes, the 1th row in the example, and the 5th byte in a different order.

2. Use the-c parameter to display the differential characters

3. Use the-l parameter to compare two files all different places

The first column is the byte position, and the 2nd, 3 columns are octal bytes

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

"Linux command-File management class" CMP command

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.