Find Search Substituir de marco para marco - incluindo tudo entre

2

Eu tenho a seguinte string

>gi|374638939|gb|AEZ55452.1| myosin light chain 2, partial [Batrachoseps major]
AAMGR

Repetir esporadicamente em todo o meu documento e deseja remover tudo de >gi|37463 para a sequência 'AAMGR

Mas, quero manter os blocos em que JQ250 aparece:

>gi|374638936|gb|**JQ250**332.1| Batrachoseps major isolate b voucher DBW5974 myosin light chain 2 gene, partial cds
GCNGCCATGGGTAAGTGAACGCGCCGGACCAGACCATTCACTGCATGCAATGGGGGCGTTTGTGGGTTGG
AAGGTGTGCCAAAGATCTAGGGAACCCCAACTCCTCAGGATACGGGTGGGAGCCCTAAAATATGTCCAGC
TATAAGGAGATGACCAATGGAAAAGGGGGTATCAGCAGTACTTTACCTGCTACTATAAGAGAATTGCATC
CTGGGAATAGCCTCTGAAAGGTCCCATTTTAGCGACACTGGTAGATGGACACTGGCCTTTGGACAGCACC
AGTAAGTAGAGCATTGCATCTTGGGATTCCTTTGCTGTTCACATGCCACTGAAAGCTCTCACCATAGCAG
ATTCAAAATGCCTACCCGGCAGGTTGCCAGAAAAGCACTGCATCATGGGAGAACCACTTTTAGTGACAAT
TCTAAGAGATGGGTGTCTCTCTGCCAGGCGCTATTATCCAGAGACCCCAGTATGACGTCGTCATTGCTCC
CAGGTAACCATGTTCTCACCCCCTCTCCCACAGGCCGC

E remova apenas as linhas que têm AEZ554

>gi|374638939|gb|**AEZ554**52.1| myosin light chain 2, partial [Batrachoseps major]
AAMGR

Então, idealmente, o seguinte bloco:

>gi|374638934|gb|JQ250331.1| Batrachoseps major isolate a voucher DBW5974 myosin light chain 2 gene, partial cds
GCNGCCATGGGTAAGTGAACGCGCCGGACCAGACCATTCACTGCATGCAATGGGGGCGTTTGTGGGTTGG
AAGGTGTGCCAAAGATCTAGGGAACCCCAACTCCTCAGGATACGGGTGGGAGCCCTAAAATATGTCCAGC
TATAAGGAGATGACCAATGGAAAAGGGGGTATCAGCAGTACTTTACCTGCTACTATAAGAGAATTGCATC
CTGGGAATAGCCTCTGAAAGGTCCCATTTTAGCGACACTGGTAGATGGACACTGGCCTTTGGACAGCACC
AGTAAGTAGAGCATTGCATCTTGGGATTCCTTTGCTGTTCACATGCCACTGAAAGCTCTCACCATAGCAG
ATTCAAAATGCCTACCCGGCAGGTTGCCAGAAAAGCACTGCATCATGGGAGAACCACTTTTAGTGACAAT
TCTAAGAGATGGGTGTCTCTCTGCCAGGCGCTATTATCCAGAGACCCCAGTATGACGTCGTCATTGCTCC
CAGGTAACCATGTTCTCACCCCCTCTCCCACAGGCCGC

>gi|374638935|gb|AEZ55450.1| myosin light chain 2, partial [Batrachoseps major]
AAMGR

>gi|374638936|gb|JQ250332.1| Batrachoseps major isolate b voucher DBW5974 myosin light chain 2 gene, partial cds
GCNGCCATGGGTAAGTGAACGCGCCGGACCAGACCATTCACTGCATGCAATGGGGGCGTTTGTGGGTTGG
AAGGTGTGCCAAAGATCTAGGGAACCCCAACTCCTCAGGATACGGGTGGGAGCCCTAAAATATGTCCAGC
TATAAGGAGATGACCAATGGAAAAGGGGGTATCAGCAGTACTTTACCTGCTACTATAAGAGAATTGCATC
CTGGGAATAGCCTCTGAAAGGTCCCATTTTAGCGACACTGGTAGATGGACACTGGCCTTTGGACAGCACC
AGTAAGTAGAGCATTGCATCTTGGGATTCCTTTGCTGTTCACATGCCACTGAAAGCTCTCACCATAGCAG
ATTCAAAATGCCTACCCGGCAGGTTGCCAGAAAAGCACTGCATCATGGGAGAACCACTTTTAGTGACAAT
TCTAAGAGATGGGTGTCTCTCTGCCAGGCGCTATTATCCAGAGACCCCAGTATGACGTCGTCATTGCTCC
CAGGTAACCATGTTCTCACCCCCTCTCCCACAGGCCGC

>gi|374638937|gb|AEZ55451.1| myosin light chain 2, partial [Batrachoseps major]
AAMGR

>gi|374638938|gb|JQ250333.1| Batrachoseps major isolate a voucher MVZ:Herp:249023 myosin light chain 2 gene, partial cds
GCCGCCATGGGTAAGTGAACGCGCCGGACCAGACCATTCACTGCCTGCAATGGGGGTGTTTGTGGGTTGG
AAGGTGTGCCAAAGATCTAGGGAACCCCAACTCCTCAGGATACGGGTGGGAGCCCTAAAATATGTCCAGC
TATAAGGAGATGACCAATGGAAAAGGGGGTATCAGCAGTACTTTACTTGCTACTATAAGAGAATTGCATC
CTGGGAATAGCCTCTGAAAGGTCCCATTTTAGCGACACTGGTAGATGGACACTGGCCTTTGGACAGCACC
AGTAAGTAGAGCATTGCATCTTGGGATTCCTTTGCTGTTCACATGCCACTGAAAGCTCTCACCATAGCAG
ATTCAAAATGCCTACCCGGCAGGTTGCCAGAAAAGCACTGCATCATGGGAGAACCACTTTTAGTGACAAT
CCTAAGAGATGGGTGTCTCTCTGCCAGGCGCTATTATCCAAGAGACCCCAGTATGACGTCGTCATTGCTC
CCAGGTAACCATGTTCTCACCCCCTCTCCCACAGGCCGC

>gi|374638939|gb|AEZ55452.1| myosin light chain 2, partial [Batrachoseps major]
AAMGR

Ficaria apenas

>gi|374638934|gb|JQ250331.1| Batrachoseps major isolate a voucher DBW5974 myosin light chain 2 gene, partial cds
GCNGCCATGGGTAAGTGAACGCGCCGGACCAGACCATTCACTGCATGCAATGGGGGCGTTTGTGGGTTGG
AAGGTGTGCCAAAGATCTAGGGAACCCCAACTCCTCAGGATACGGGTGGGAGCCCTAAAATATGTCCAGC
TATAAGGAGATGACCAATGGAAAAGGGGGTATCAGCAGTACTTTACCTGCTACTATAAGAGAATTGCATC
CTGGGAATAGCCTCTGAAAGGTCCCATTTTAGCGACACTGGTAGATGGACACTGGCCTTTGGACAGCACC
AGTAAGTAGAGCATTGCATCTTGGGATTCCTTTGCTGTTCACATGCCACTGAAAGCTCTCACCATAGCAG
ATTCAAAATGCCTACCCGGCAGGTTGCCAGAAAAGCACTGCATCATGGGAGAACCACTTTTAGTGACAAT
TCTAAGAGATGGGTGTCTCTCTGCCAGGCGCTATTATCCAGAGACCCCAGTATGACGTCGTCATTGCTCC
CAGGTAACCATGTTCTCACCCCCTCTCCCACAGGCCGC

>gi|374638936|gb|JQ250332.1| Batrachoseps major isolate b voucher DBW5974 myosin light chain 2 gene, partial cds
GCNGCCATGGGTAAGTGAACGCGCCGGACCAGACCATTCACTGCATGCAATGGGGGCGTTTGTGGGTTGG
AAGGTGTGCCAAAGATCTAGGGAACCCCAACTCCTCAGGATACGGGTGGGAGCCCTAAAATATGTCCAGC
TATAAGGAGATGACCAATGGAAAAGGGGGTATCAGCAGTACTTTACCTGCTACTATAAGAGAATTGCATC
CTGGGAATAGCCTCTGAAAGGTCCCATTTTAGCGACACTGGTAGATGGACACTGGCCTTTGGACAGCACC
AGTAAGTAGAGCATTGCATCTTGGGATTCCTTTGCTGTTCACATGCCACTGAAAGCTCTCACCATAGCAG
ATTCAAAATGCCTACCCGGCAGGTTGCCAGAAAAGCACTGCATCATGGGAGAACCACTTTTAGTGACAAT
TCTAAGAGATGGGTGTCTCTCTGCCAGGCGCTATTATCCAGAGACCCCAGTATGACGTCGTCATTGCTCC
CAGGTAACCATGTTCTCACCCCCTCTCCCACAGGCCGC

>gi|374638938|gb|JQ250333.1| Batrachoseps major isolate a voucher MVZ:Herp:249023 myosin light chain 2 gene, partial cds
GCCGCCATGGGTAAGTGAACGCGCCGGACCAGACCATTCACTGCCTGCAATGGGGGTGTTTGTGGGTTGG
AAGGTGTGCCAAAGATCTAGGGAACCCCAACTCCTCAGGATACGGGTGGGAGCCCTAAAATATGTCCAGC
TATAAGGAGATGACCAATGGAAAAGGGGGTATCAGCAGTACTTTACTTGCTACTATAAGAGAATTGCATC
CTGGGAATAGCCTCTGAAAGGTCCCATTTTAGCGACACTGGTAGATGGACACTGGCCTTTGGACAGCACC
AGTAAGTAGAGCATTGCATCTTGGGATTCCTTTGCTGTTCACATGCCACTGAAAGCTCTCACCATAGCAG
ATTCAAAATGCCTACCCGGCAGGTTGCCAGAAAAGCACTGCATCATGGGAGAACCACTTTTAGTGACAAT
CCTAAGAGATGGGTGTCTCTCTGCCAGGCGCTATTATCCAAGAGACCCCAGTATGACGTCGTCATTGCTC
CCAGGTAACCATGTTCTCACCCCCTCTCCCACAGGCCGC
    
por Erick Tronboll 25.09.2012 / 02:26

1 resposta

3

Primeiro passo: verifique se você está executando a versão mais recente do Notepad ++ (deve funcionar em 6 ou superior, testado em 6.1.8) - graças a Bob para isso. Você pode usar o modo "Expressão regular" da caixa de diálogo Localizar e substituir do Notepad ++ para remover o texto entre dois marcadores.

Para corresponder a todas as linhas que começam com >gi|37463 e terminar com AAMGR , coloque isso na caixa "Localizar:" >gi\|37463.*AAMGR(\r\n)? , deixe a caixa "Substituir com:" vazia, defina o modo na parte inferior para "Expressão regular" e certifique-se de que ". corresponde à nova linha" está desmarcada .

Para corresponder apenas às linhas com AEZ554 , use essa string de pesquisa >gi\|37463.*AEZ554.*AAMGR(\r\n)?

Para corresponder a todos que não contêm JQ250 , use esta string de pesquisa >gi\|37463(?!.*JQ250).*AAMGR(\r\n)?

Observação: pode ser necessário usar apenas \n em vez de \r\n se o arquivo foi criado em unix / linux.

Observação 2: se você quiser deixar uma linha em branco no arquivo em vez de remover a linha completamente, remova o (\r\n)? do termo de pesquisa.

Observação 3: Se a pergunta for "Como remover linhas contendo AEZ554 de um arquivo de texto?" os seguintes comandos shell funcionariam (e seriam mais rápidos):

no Windows XP: type oldfile.txt | find /I /V "AEZ55" > newfile.txt

no Linux / Windows 7: grep -v "AEZ55" oldfile.txt > newfile.txt

Da mesma forma, "Como removo linhas que não contêm JQ250 de um arquivo de texto?"

type oldfile.txt | find /I "JQ250" > newfile.txt

grep "JQ250" oldfile.txt > newfile.txt

    
por 25.09.2012 / 03:39

Tags