Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion Who knows `diff`?

Received: by 10.180.107.167 with SMTP id hd7mr634090wib.0.1350048388481;
        Fri, 12 Oct 2012 06:26:28 -0700 (PDT)
Path: q10ni65098482wif.0!nntp.google.com!proxad.net!feeder1-2.proxad.net!feeder.erje.net!eternal-september.org!feeder.eternal-september.org!mx04.eternal-september.org!.POSTED!not-for-mail
From: Joe Beanfish <joebeanf...@nospam.duh>
Newsgroups: comp.os.linux.misc
Subject: Re: Who knows `diff`?
Date: Fri, 12 Oct 2012 13:26:28 +0000 (UTC)
Organization: A noiseless patient Spider
Lines: 53
Message-ID: <k595q3$dmr$1@dont-email.me>
References: <k57ivh$oko$1@dont-email.me>
Mime-Version: 1.0
Injection-Date: Fri, 12 Oct 2012 13:26:28 +0000 (UTC)
Injection-Info: mx04.eternal-september.org; posting-host="313db50f4c72eb289d3da01eac0fa197";
	logging-data="14043"; mail-complaints-to="ab...@eternal-september.org";	posting-account="U2FsdGVkX18XLGGpLK43gi8keeFZX18D+WhgO4miCNI="
User-Agent: Pan/0.135 (Tomorrow I'll Wake Up and Scald Myself with Tea; GIT
	30dc37b master)
Cancel-Lock: sha1:/W6T+jL4k3NDW4ZDFIfZsH7a6jI=
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

On Thu, 11 Oct 2012 22:58:58 +0000, Avoid9Pdf wrote:

> -> whatis diff ==
> diff []              (1)  - compare files line by line
> 
> AFAICS `diff` doesn't so much show you what the difference is. Nor does
> it <get you from FileA to FileB>.

Who said it's supposed to? As the manual states it's purpose it to show
you the diff[erence] between two files. It is not intended to edit
anything. Additionally the patch command can read it's output to
get you from filea to fileb but that's only a fraction of usage cases
for diff.

> 
> Rather it 'sells you a ticket' to  <get you from FileA to FileB>. You
> are not supposed to understand the ticket, which `patch`
> [or some other bus company] uses to <get you from FileA to FileB>.
> 
> 
> man/info says:-------------------------
> `RdL'
>      Delete the lines in range R from the first file; line L is where
>      they would have appeared in the second file had they not been
>      deleted.  For example, `5,7d3' means delete lines 5-7 of file 1;
>      or, if changing file 2 into file 1, append lines 5-7 of file 1
>      after line 3 of file 2.
> ------------------------------------
> 
> AFAIK the English meaning of 'append' in 'add at the END'

If you're going to be pedantic do your homework first. The definition
of append doesn't include "end". The manual's description quoted above
is accurate and precise.

> Apparently `diff` has good algorithms for comparing <* Hunks::          
>   Groups of differing lines>
> in various heuriatic, human-like ways; like ignoring different
> white-chars and even with regex fcilities.
> 
> But can it be used to:
>  delete all further huncks in File1 which match File2?

Diff doesn't edit at all. And your question is unclear. If you're going
to whine about people's writing you better get yours right.

Provide some detail of what you want to accomplish and someone may be
able to help. Leave out the whining, it just hides your actual question.

> PS. I know it's difficult to write a good `man` for a subtle utility;
> but how many decades of successive refinement do you need to correct it?

Who said anyone's refining it? It's generally sufficient to the task.