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

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

Re: How to compare a .gz and a txt file


From: Davide Brini
Subject: Re: How to compare a .gz and a txt file
Date: Wed, 19 May 2010 10:19:15 +0100
User-agent: KMail/1.12.4 (Linux/2.6.31-gentoo-r10; KDE/4.3.5; x86_64; ; )

On Wednesday 19 May 2010 10:07:27 Peng Yu wrote:

> Suppose I have a file xxx.txt.gz and a file xxx.txt, I'm wondering how
> to compare the content inside xxx.txt.gz with xxx.txt without first
> explicitly gunzip xxx.txt.gz (I want to avoid creating a temp file
> because both xxx.txt.gz and xxx.txt are huge). Is there just one
> command allowing me to compare xxx.txt.gz and xxx.txt?

You don't need a temporary file. You can do

gunzip -c xxx.txt.gz | diff xxx.txt -

or with bash

diff xxx.txt <(gunzip -c xxx.txt.gz)

Another option would be to use zdiff that comes with gzip.

-- 
D.



reply via email to

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