Listing lines from just one file in DIFF

Posted by justintime on Super User See other posts from Super User or by justintime
Published on 2010-04-27T13:19:17Z Indexed on 2010/04/27 13:24 UTC
Read the original article Hit count: 377

Filed under:
|
|

I would like to get (GNU)DIFF to printout only lines that are different in one file. So given

    ==> diffa.txt <==
    line1
    line2 - in a only
    line3
    line4 changed
    line5

    ==> diffb.txt <==
    line1
    line3
    line4 changed in b
    line5
    line6 in b only

i would like diff --someoption diffa.txt diffb.txt to produce

    line2 - in a only

    line4 changed

The following looks as though it should be helpful but it is a bit cryptic :

   --GTYPE-group-format=GFMT
          Similar, but format GTYPE input groups with GFMT.

   --line-format=LFMT
          Similar, but format all input lines with LFMT.

   --LTYPE-line-format=LFMT
          Similar, but format LTYPE input lines with LFMT.

   LTYPE is `old', `new', or `unchanged'.
          GTYPE is LTYPE or `changed'.

          GFMT may contain:

   %<     lines from FILE1

   %>     lines from FILE2

© Super User or respective owner

Related posts about gnudiff

Related posts about diff