help-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: diff on .gz and .bz2 files


From: Peng Yu
Subject: Re: diff on .gz and .bz2 files
Date: Sat, 30 Jan 2010 20:34:05 -0600

On Sat, Jan 30, 2010 at 10:11 AM, jellybean stonerfish
<address@hidden> wrote:
> On Fri, 29 Jan 2010 09:20:22 -0600, Peng Yu wrote:
>
>> It seems that diff can not do comparison on the decompressed files in
>> .gz and .bz2 files. I could first decompress the .gz and .bz2 file and
>> then do the comparison. But it would be convenient to be able to
>> directly compare without explicitly decompressing any files. Could
>> somebody add this feature to diff?
>
> You could make a little script pretty easy.
>
> $ cat /home/js/bin/gzbzdiff
> #!/bin/bash
>
> mkfifo gzi
> mkfifo bzi
>
> gunzip -c $1 > gzi &
> bunzip2 -c $2  > bzi &
> diff -s bzi gzi
> rm bzi gzi
>
> $ gzbzdiff nsd.gz nsd.bz2
> Files bzi and gzi are identical

Of course, I could. But I think this may not be an efficient way if
the .gz file is too large, say of the order of GB.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]