Clipper On Line • Ver Tópico - Comparar arquivos txt
Página 1 de 1

Comparar arquivos txt

MensagemEnviado: 08 Jan 2020 15:09
por JoséQuintas
Procurei na internet, mas só encontrei programas que mostram linhas diferentes.
Tem algum utilitário prático pra isso?

Criei um simples, mas acho que vai longe pra ficar mais útil

PROCEDURE Main

   LOCAL aTxt1, aTxt2, nCont
   SetMode( 50, 100 )
   CLS
   aTxt1 := hb_RegExSplit( hb_Eol(), MemoRead( "d:\jpa\ro\exporta\simpok.txt" ) )
   aTxt2 := hb_RegExSplit( hb_Eol(), MemoRead( "d:\jpa\ro\exporta\simp1912.txt" ) )
   ? Len( aTxt1 )
   Inkey(0)
   FOR nCont = 1 TO Len( aTxt1 )
      Show( aTxt1[ nCont ], aTxt2[ nCont ] )
   NEXT
   Inkey(0)

   RETURN

FUNCTION Show( cTxt1, cTxt2 )

   LOCAL nCont

   IF cTxt1 == cTxt2
      RETURN NIL
   ENDIF
   Scroll( 0, 0, 50, 100, 1 )
   FOR nCont = 1 TO Len( cTxt1 )
      @ 49, nCont - 1 SAY Substr( cTxt1, nCont, 1 ) COLOR ;
         iif( Substr( cTxt1, nCont, 1 ) <> Substr( cTxt2, nCont, 1 ), "W/R", "W/B" )
   NEXT

   RETURN NIL


dif.png

Comparar arquivos txt

MensagemEnviado: 08 Jan 2020 18:18
por alxsts
Olá!

Costumo utilizar o BeyondCompare. Me atende.