Comparar Linhas com espaço

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ccmancio
    Old Hand
    • May 2005
    • 235

    Comparar Linhas com espaço

    Como faço para ignorar as linhas cuja diferença seja somente espaços (no inicio, no meio, ou no fim).

    Só funciona quando tem espaços no final (Trailing whitespace)

    Não esta assinalado "Leading whitespace" (no ínicio?), nem "Embedded whitespace" (no meio ?), mas continua mostrando as linhas como diferentes.
    Veja anexo

    Estou BC.3.3 Beta (Build13755)
    Last edited by ccmancio; 03-Aug-2011, 10:07 AM.
  • Aaron
    Team Scooter
    • Oct 2007
    • 16000

    #2
    Hello,

    The Whitespace characters are unimportant differences, but you also have "." and "X" characters, which are Important differences, and will show as Red. You can toggle Show Whitespace characters to see the actual whitespace characters present, and if they are blue or not.

    translate.google.com
    Olá,

    Os caracteres Whitespace diferenças sem importância, mas você também tem "." e "X" caracteres, que são diferenças importantes, e irá mostrar como Vermelho. Você pode alternar personagens Mostrar Whitespace para ver os caracteres reais whitespace presente, e se eles são azuis ou não.
    Aaron P Scooter Software

    Comment

    • ccmancio
      Old Hand
      • May 2005
      • 235

      #3
      Não existe o ponto (.) e apenas uma representação do espaço, e são estes espaços que eu queria desconsiderar. Acho que deixei alguns no arquivo, agora troquei por espacos.

      O problema é que quando eu uso o "Grammar elements" , no caso para desconsiderar as linhas que terminam com digitos.

      Veja o caso :
      Arquivo1
      Linha 1 0000
      Linha 2

      Arquivo2
      Linha 1 0000 (começa com um espaço em branco)
      Linha 2 (começa com um espaço em branco)

      No "<default>" :
      A primeira linha é informada como igual (correto)
      A segunda linha é informada como diferente (correto)]

      Mas eu necessito ignorar as linhas terminando com digitos( 4 no caso) :
      Então criei um Grammar Element : [0-9]$
      E deixei desmarcado nos "Grammar elements"
      O resultado ficou o seguinte :
      A primeira linha é informada como igual (correto), pois esta despresando os digitos no final,
      mas a segunda linha agora diz que é diferente (errado) pois ela não tem digitos e deveria continuar igual como no "default"

      onde estou errando ?
      o mesmo acontece para espaços dentro da linha.
      Só funciona para espacos no final da linha

      Comment

      • Aaron
        Team Scooter
        • Oct 2007
        • 16000

        #4
        Hello,

        In Arquivo1.txt and Arquivo2.txt, there are some "." characters in the file. While previewing it, I also initially thought they were spaces, but the . is lower in the line. Disable "Show Whitespace" to see which are actual "." characters.

        This is assuming the <default> file format.

        If you have defined a grammar that contains the whitespace characters, then they are a part of that grammar. If that grammar is Important, so is the whitespace. The options in the Importance tab for Leading, Embedded and Trailing Whitespace only apply to "Default text". This is text that is not defined by another grammar element. You will need to delete the grammar element to revert the text to default, or mark it as unimportant to make the entire grammar unimportant.

        If you click the cursor into the whitespace, look at the bottom status bar of the pane to see if it says "Default text" or a grammar element name to know if the cursor is currently in a defined grammar.
        Aaron P Scooter Software

        Comment

        • ccmancio
          Old Hand
          • May 2005
          • 235

          #5
          E como fazer então ?

          Então como fazer para ignorar os Leading and Embedded "whitespace" usando um "GrammarElement" ?

          Segue anexo os Arquivos corrigidos para teste, bem como as definicoes do BC.
          Retirar a extensão antes de copiar.
          Usar a seção TesteParaBC acertando o caminho onde voce salvar.
          Apos abrir a seção
          Comparar os arquivos Arquivo1 e Arquivo2, que devem usar o FileFormat "TSOwithNumbers"

          Deveria responder que os arquivos, exceto no "CONJUNTO 5"
          Veja anexo o resultado e o que eu desejo

          Comment

          • Aaron
            Team Scooter
            • Oct 2007
            • 16000

            #6
            Hello,

            Both attached pictures seem to be the same file. I can get those results by making Everything Else important, and by making your TSONumbers grammar element unimportant.

            TSONumbers does not match on the right side because there is trailing whitespace. You would need to change the definition to:
            [0-9][0-9]\s*$

            translate.google.com
            Olá,

            Ambas as imagens em anexo parece ser o mesmo arquivo. Eu posso obter esses resultados, tornando Outras vendas importantes, e fazendo o seu elemento gramatical TSONumbers sem importância.

            TSONumbers não corresponde, no lado direito porque não há espaços em branco. Você precisa alterar a definição para:
            [0-9][0-9]\s*$
            Aaron P Scooter Software

            Comment

            • ccmancio
              Old Hand
              • May 2005
              • 235

              #7
              Figura correta

              Segue anexo a figura do resultado desejado.

              Se eu desmarcar "Everthing Else", não vai mostrar as diferenças existentes.

              Comment

              • Aaron
                Team Scooter
                • Oct 2007
                • 16000

                #8
                Hello,

                I think you are having trouble because you have enabled Column-based data, so the 00 and 01 aren't aligning as you expect, which throws off the XXX and YYY alignments.

                Go to the Tools menu -> File Formats -> TSO with Number Files, and in the Misc tab, disable Column based alignment.

                Then mark your grammar as unimportant, and Everything Else as important.

                translate.google.com
                Olá,

                Eu acho que você está tendo problemas porque você tem habilitado coluna baseada em dados, de modo que o 00 e 01 não estão se alinhando como você espera, que joga fora a XXX e YYY alinhamentos.

                Vá para o menu Ferramentas - Formatos> File -> TSO com arquivos Number, e na guia Misc, desativar o alinhamento de coluna baseada.

                Em seguida, marque a sua gramática como sem importância, e tudo o mais importante.
                Aaron P Scooter Software

                Comment

                • ccmancio
                  Old Hand
                  • May 2005
                  • 235

                  #9
                  Quase

                  Funcionou para "Leading" e "Embeded", mas o "Trailing" continua aparecendo como diferente.
                  GrammarElement = [0-9][0-9]$ funciona, [0-9][0-9]/s$ não funciona

                  Comment

                  • Aaron
                    Team Scooter
                    • Oct 2007
                    • 16000

                    #10
                    Hello,

                    The grammar needs to be:
                    Code:
                    [0-9][0-9]\s*$
                    Where
                    [0-9][0-9] are two digits.
                    \s* is: \s = Whitespace. * = 0 or more
                    $ is the end of the line.
                    Aaron P Scooter Software

                    Comment

                    • ccmancio
                      Old Hand
                      • May 2005
                      • 235

                      #11
                      Agora funcionou !!!

                      Mas eu precisei criar 2 GrammarElement, um com *\s e outro sem *\

                      Muito Obrigado

                      Comment

                      • Aaron
                        Team Scooter
                        • Oct 2007
                        • 16000

                        #12
                        \s* Should represent 0 or more whitespaces. The order of syntax is very important, and the * must come after the \s.
                        Aaron P Scooter Software

                        Comment

                        • ccmancio
                          Old Hand
                          • May 2005
                          • 235

                          #13
                          Digitei errado, realmente usei \s, mas faltava o * apos \s.
                          Agora só uso um GrammarElements
                          Obrigado novamente

                          Comment

                          Working...