0

So if file A is 1 2 3 4 and file B is 1 2 3 4a I want the output to be 1 2 3 4 4a I can manually do this in KDIFF3 but I want to automatically do this for all 4000+ diffs.

2 Answers2

0

Perhaps use GNU diff with If-then-else (--ifdef=SIMPLE_MERGE) and then post process that result by removing the following lines:

#ifdef SIMPLE_MERGE
#ifndef SIMPLE_MERGE
#else /* SIMPLE_MERGE */
#endif /* SIMPLE_MERGE */

or use the line format options to define your own text to remove. See --old-line-format, --new-line-format, --unchanged-line-format

Eric MSFT
  • 3,246
  • 1
  • 18
  • 28
0

I spent around 3 hours going down different paths. The final solution takes about 5 minutes.

  1. download diff.exe from Binaries found at http://gnuwin32.sourceforge.net/packages/diffutils.htm
  2. Rename each file so it is easy to reference A.lex B.lex
  3. Since both files are identical I renamed one set of markers with added -cy
  4. diff --text --ifdef=name a.lex b.lex > out2.txt

output looks like:

\_sh v3.0  724  English-Uzbek Dictionary

\lx ability
\cl N-05; related to: able
\cl J-09
\bk 5
\fr 4
\ph əbˈɪlɪti
\pd abilities
\ps noun
\sn 1
\sdw 09 cognition - nouns denoting cognitive processes and contents
\ss Sense 02: 03841132 ability, power - possession of the qualities (especially mental qualities) required to do something or get something done
\de a way to refer to the fact that you can do something
\xe The baby doesn't have the ability to hold her head up without help.
\xe I have confidence in my brother's ability to do the job.
#ifndef name
\du-cy бирор бир нарсани қила олишингизни англатиш йўли
\gu-cy қобилият
#else /* name */
\du biror bir narsani qila olishingizni anglatish yoʻli
\gu qobiliyat
#endif /* name */
\sn 2
\sdw 07 attribute - nouns denoting attributes of people and objects
\ss Sense 01: 03601639 ability - the quality of being able to perform; a quality that permits or facilitates achievement or accomplishment
\de the quality or skill that makes it possible for someone to do something successfully
\xe My friend's artistic ability is far greater than my own.
\xe The media has continually criticized his leadership abilities.
#ifndef name
\du-cy бирор бир нарсани яхши қилишга имконият берадиган фазилат ёки маҳорат
#else /* name */
\du biror bir narsani yaxshi qilishga imkoniyat beradigan fazilat yoki mahorat
#endif /* name */
\sn 3
\de a person's level of talent, skill or intelligence
\xe She is a student of average ability.
\xe There are doctors of all abilities at that hospital.
#ifndef name
\du-cy бирор бир кишининг маҳорати, қобилияти ёки ақл даражаси
#else /* name */
\du biror bir kishining mahorati, qobiliyati yoki aql darajasi
#endif /* name */
\sn 4
\se do something to the best of your ability
\de do something as well as you can
\xe Whatever you do, do it to the best of your ability.
#ifndef name
\du-cy бирор бир нарсани қўлингиздан келганича яхшироқ қилмоқ
#else /* name */
\du biror bir narsani qoʻlingizdan kelganicha yaxshiroq qilmoq
#endif /* name */

Do search and replace with nothing to remove unnecessary tags
#ifndef name
#else /* name */
#endif /* name */