bzdiff command in linux with examples

bzdiff command in Linux is used to compare the bzip2 compressed files. Bzcmp and bzdiff are used to invoke the cmp or the diff program on bzip2 compressed files. All options specified are passed directly to cmp or diff. If only one file is specified, then the files compared are file1 and an uncompressed file1.bz2. If two files are specified, then they are uncompressed if necessary and fed to cmp or diff. The exit status from cmp or diff is preserved.

Synopsis:

bzcmp [ cmp_options ] file1 [ file2 ]
bzdiff [ diff_options ] file1 [ file2 ]

Example 1: Comparing two files as follows:



  • Create the two files as follows:

  • Now compressing both the files. After that compares both the files as follows:

    Here, in the above snapshot:

    “1c1” : Shows that first line in the file1.bz2 needs to be changed in order to match the lines of file2.bz2

    >” : Displays the lines in file1.bz2

    <” : Displays the lines in file2.bz2

Example 2: Here, we will use bzdiff with Single parameter. bzdiff utility compares the file1.bz2 and file1



My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.




Article Tags :

Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.