Is there any way to Find similar words one below another in 2 lines





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







0















We have a large file in unix/windows.
The data in it is like



update table tblName set col1='Test' where col1='Test1'
select * from a
select * from b
delete from tblName where col1='xyz'
select * from a
select * from b
select * from c
delete from tblName where col1='pqr'
select * from c


I want to search all the lines where 2 or more select statements appears one below another in VI or Notepad++ and any other editor.



E.g.



Search should find



select * from a
select * from b


Or even



select * from a
select * from b
select * from c


but not



select * from c (the last line)


Can someone please help?










share|improve this question































    0















    We have a large file in unix/windows.
    The data in it is like



    update table tblName set col1='Test' where col1='Test1'
    select * from a
    select * from b
    delete from tblName where col1='xyz'
    select * from a
    select * from b
    select * from c
    delete from tblName where col1='pqr'
    select * from c


    I want to search all the lines where 2 or more select statements appears one below another in VI or Notepad++ and any other editor.



    E.g.



    Search should find



    select * from a
    select * from b


    Or even



    select * from a
    select * from b
    select * from c


    but not



    select * from c (the last line)


    Can someone please help?










    share|improve this question



























      0












      0








      0








      We have a large file in unix/windows.
      The data in it is like



      update table tblName set col1='Test' where col1='Test1'
      select * from a
      select * from b
      delete from tblName where col1='xyz'
      select * from a
      select * from b
      select * from c
      delete from tblName where col1='pqr'
      select * from c


      I want to search all the lines where 2 or more select statements appears one below another in VI or Notepad++ and any other editor.



      E.g.



      Search should find



      select * from a
      select * from b


      Or even



      select * from a
      select * from b
      select * from c


      but not



      select * from c (the last line)


      Can someone please help?










      share|improve this question
















      We have a large file in unix/windows.
      The data in it is like



      update table tblName set col1='Test' where col1='Test1'
      select * from a
      select * from b
      delete from tblName where col1='xyz'
      select * from a
      select * from b
      select * from c
      delete from tblName where col1='pqr'
      select * from c


      I want to search all the lines where 2 or more select statements appears one below another in VI or Notepad++ and any other editor.



      E.g.



      Search should find



      select * from a
      select * from b


      Or even



      select * from a
      select * from b
      select * from c


      but not



      select * from c (the last line)


      Can someone please help?







      unix vim notepad++ vi






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Jan 4 at 12:47









      Toto

      66.9k1758100




      66.9k1758100










      asked Jan 4 at 12:10









      PranavPranav

      99111




      99111
























          2 Answers
          2






          active

          oldest

          votes


















          0
















          • Ctrl+F

          • Find what: (^select * from.*R)(?1)+

          • UNcheck Match case

          • check Wrap around

          • check Regular expression

          • UNCHECK . matches newline

          • Find next


          Explanation:



          (                   # start group 1
          ^ # beginning of line
          select * from # literally
          .* # 0 or more any character but newline
          R # any kind of linebreak (ie. r, n, rn)
          ) # end group 1
          (?1)+ # repeat pattern defined in group 1, 1 or more times





          share|improve this answer































            0














            You should look into regular expressions for that. You should check which standard your text editor uses, you will find that in the documentation (Notepad++, vim) On vim, you can also do :help pattern to find documentation about this. In most text editors, this regex should work:



            (select * from w+n){2,}


            It matches two or more lines in succesion that are in the form



            select * from (some variable made up of letters, numbers and underscores)


            It will not match



            select * from a where property = "foo"


            In vim, things are slightly different, you will have to use the pattern



            (select * from w+n){2,}


            so then you can do things like replacing those lines



            :%s/(select * from w+n){2,}/hey, two or more select statements were removed herer/g


            (be careful though, those lines will be replaced in the whole file, so check what you will be losing).



            There are also more details that you might want to consider, for instance case-sensitive vs. case-insensitive search and empty lines.






            share|improve this answer


























              Your Answer






              StackExchange.ifUsing("editor", function () {
              StackExchange.using("externalEditor", function () {
              StackExchange.using("snippets", function () {
              StackExchange.snippets.init();
              });
              });
              }, "code-snippets");

              StackExchange.ready(function() {
              var channelOptions = {
              tags: "".split(" "),
              id: "1"
              };
              initTagRenderer("".split(" "), "".split(" "), channelOptions);

              StackExchange.using("externalEditor", function() {
              // Have to fire editor after snippets, if snippets enabled
              if (StackExchange.settings.snippets.snippetsEnabled) {
              StackExchange.using("snippets", function() {
              createEditor();
              });
              }
              else {
              createEditor();
              }
              });

              function createEditor() {
              StackExchange.prepareEditor({
              heartbeatType: 'answer',
              autoActivateHeartbeat: false,
              convertImagesToLinks: true,
              noModals: true,
              showLowRepImageUploadWarning: true,
              reputationToPostImages: 10,
              bindNavPrevention: true,
              postfix: "",
              imageUploader: {
              brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
              contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
              allowUrls: true
              },
              onDemand: true,
              discardSelector: ".discard-answer"
              ,immediatelyShowMarkdownHelp:true
              });


              }
              });














              draft saved

              draft discarded


















              StackExchange.ready(
              function () {
              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54038726%2fis-there-any-way-to-find-similar-words-one-below-another-in-2-lines%23new-answer', 'question_page');
              }
              );

              Post as a guest















              Required, but never shown

























              2 Answers
              2






              active

              oldest

              votes








              2 Answers
              2






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes









              0
















              • Ctrl+F

              • Find what: (^select * from.*R)(?1)+

              • UNcheck Match case

              • check Wrap around

              • check Regular expression

              • UNCHECK . matches newline

              • Find next


              Explanation:



              (                   # start group 1
              ^ # beginning of line
              select * from # literally
              .* # 0 or more any character but newline
              R # any kind of linebreak (ie. r, n, rn)
              ) # end group 1
              (?1)+ # repeat pattern defined in group 1, 1 or more times





              share|improve this answer




























                0
















                • Ctrl+F

                • Find what: (^select * from.*R)(?1)+

                • UNcheck Match case

                • check Wrap around

                • check Regular expression

                • UNCHECK . matches newline

                • Find next


                Explanation:



                (                   # start group 1
                ^ # beginning of line
                select * from # literally
                .* # 0 or more any character but newline
                R # any kind of linebreak (ie. r, n, rn)
                ) # end group 1
                (?1)+ # repeat pattern defined in group 1, 1 or more times





                share|improve this answer


























                  0












                  0








                  0









                  • Ctrl+F

                  • Find what: (^select * from.*R)(?1)+

                  • UNcheck Match case

                  • check Wrap around

                  • check Regular expression

                  • UNCHECK . matches newline

                  • Find next


                  Explanation:



                  (                   # start group 1
                  ^ # beginning of line
                  select * from # literally
                  .* # 0 or more any character but newline
                  R # any kind of linebreak (ie. r, n, rn)
                  ) # end group 1
                  (?1)+ # repeat pattern defined in group 1, 1 or more times





                  share|improve this answer















                  • Ctrl+F

                  • Find what: (^select * from.*R)(?1)+

                  • UNcheck Match case

                  • check Wrap around

                  • check Regular expression

                  • UNCHECK . matches newline

                  • Find next


                  Explanation:



                  (                   # start group 1
                  ^ # beginning of line
                  select * from # literally
                  .* # 0 or more any character but newline
                  R # any kind of linebreak (ie. r, n, rn)
                  ) # end group 1
                  (?1)+ # repeat pattern defined in group 1, 1 or more times






                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Jan 4 at 12:54









                  TotoToto

                  66.9k1758100




                  66.9k1758100

























                      0














                      You should look into regular expressions for that. You should check which standard your text editor uses, you will find that in the documentation (Notepad++, vim) On vim, you can also do :help pattern to find documentation about this. In most text editors, this regex should work:



                      (select * from w+n){2,}


                      It matches two or more lines in succesion that are in the form



                      select * from (some variable made up of letters, numbers and underscores)


                      It will not match



                      select * from a where property = "foo"


                      In vim, things are slightly different, you will have to use the pattern



                      (select * from w+n){2,}


                      so then you can do things like replacing those lines



                      :%s/(select * from w+n){2,}/hey, two or more select statements were removed herer/g


                      (be careful though, those lines will be replaced in the whole file, so check what you will be losing).



                      There are also more details that you might want to consider, for instance case-sensitive vs. case-insensitive search and empty lines.






                      share|improve this answer






























                        0














                        You should look into regular expressions for that. You should check which standard your text editor uses, you will find that in the documentation (Notepad++, vim) On vim, you can also do :help pattern to find documentation about this. In most text editors, this regex should work:



                        (select * from w+n){2,}


                        It matches two or more lines in succesion that are in the form



                        select * from (some variable made up of letters, numbers and underscores)


                        It will not match



                        select * from a where property = "foo"


                        In vim, things are slightly different, you will have to use the pattern



                        (select * from w+n){2,}


                        so then you can do things like replacing those lines



                        :%s/(select * from w+n){2,}/hey, two or more select statements were removed herer/g


                        (be careful though, those lines will be replaced in the whole file, so check what you will be losing).



                        There are also more details that you might want to consider, for instance case-sensitive vs. case-insensitive search and empty lines.






                        share|improve this answer




























                          0












                          0








                          0







                          You should look into regular expressions for that. You should check which standard your text editor uses, you will find that in the documentation (Notepad++, vim) On vim, you can also do :help pattern to find documentation about this. In most text editors, this regex should work:



                          (select * from w+n){2,}


                          It matches two or more lines in succesion that are in the form



                          select * from (some variable made up of letters, numbers and underscores)


                          It will not match



                          select * from a where property = "foo"


                          In vim, things are slightly different, you will have to use the pattern



                          (select * from w+n){2,}


                          so then you can do things like replacing those lines



                          :%s/(select * from w+n){2,}/hey, two or more select statements were removed herer/g


                          (be careful though, those lines will be replaced in the whole file, so check what you will be losing).



                          There are also more details that you might want to consider, for instance case-sensitive vs. case-insensitive search and empty lines.






                          share|improve this answer















                          You should look into regular expressions for that. You should check which standard your text editor uses, you will find that in the documentation (Notepad++, vim) On vim, you can also do :help pattern to find documentation about this. In most text editors, this regex should work:



                          (select * from w+n){2,}


                          It matches two or more lines in succesion that are in the form



                          select * from (some variable made up of letters, numbers and underscores)


                          It will not match



                          select * from a where property = "foo"


                          In vim, things are slightly different, you will have to use the pattern



                          (select * from w+n){2,}


                          so then you can do things like replacing those lines



                          :%s/(select * from w+n){2,}/hey, two or more select statements were removed herer/g


                          (be careful though, those lines will be replaced in the whole file, so check what you will be losing).



                          There are also more details that you might want to consider, for instance case-sensitive vs. case-insensitive search and empty lines.







                          share|improve this answer














                          share|improve this answer



                          share|improve this answer








                          edited Jan 4 at 12:51

























                          answered Jan 4 at 12:46









                          quacodasquacodas

                          738




                          738






























                              draft saved

                              draft discarded




















































                              Thanks for contributing an answer to Stack Overflow!


                              • Please be sure to answer the question. Provide details and share your research!

                              But avoid



                              • Asking for help, clarification, or responding to other answers.

                              • Making statements based on opinion; back them up with references or personal experience.


                              To learn more, see our tips on writing great answers.




                              draft saved


                              draft discarded














                              StackExchange.ready(
                              function () {
                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54038726%2fis-there-any-way-to-find-similar-words-one-below-another-in-2-lines%23new-answer', 'question_page');
                              }
                              );

                              Post as a guest















                              Required, but never shown





















































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown

































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown







                              Popular posts from this blog

                              Monofisismo

                              Angular Downloading a file using contenturl with Basic Authentication

                              Olmecas