Community
    • Login

    Find a line and copy the next 10 lines

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    16 Posts 3 Posters 2.8k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Neil SchipperN
      Neil Schipper @Muthuraj Madasamy
      last edited by

      @muthuraj-madasamy Your first example has missing asterisks * and your second has an or bar | that is not part of Alan’s solution.

      Regex machinery cares very little for your intentions, and demands rigid compliance to correct syntax.

      I suggest you copy his text, paste, and then carefully replace just the 5 characters 12345 with text you want.

      Muthuraj MadasamyM 1 Reply Last reply Reply Quote 1
      • Muthuraj MadasamyM
        Muthuraj Madasamy @Neil Schipper
        last edited by

        @neil-schipper
        Thank you and belwo is the output. This is a huge log file.

        ^.pem.\R(.*\R){10}

        I used above search but still not selecting all the lines. As you see in the below image.

        7089948e-05e7-4028-82d6-d97211cc1e77-image.png

        Neil SchipperN 2 Replies Last reply Reply Quote 0
        • Neil SchipperN
          Neil Schipper @Muthuraj Madasamy
          last edited by

          @muthuraj-madasamy Hi.
          First, remove the check from . matches newline like in the image Alan provided.

          Second, I see you used ^.pem.\R(.*\R){10}. Again, this wrong. What you need is ^.*pem.*\R(.*\R){10}. The dot . and asterisk * characters have special meaning to the software that performs regular expression processing; you cannot add/remove them casually.

          Muthuraj MadasamyM 2 Replies Last reply Reply Quote 1
          • Muthuraj MadasamyM
            Muthuraj Madasamy @Neil Schipper
            last edited by Muthuraj Madasamy

            This post is deleted!
            1 Reply Last reply Reply Quote 0
            • Muthuraj MadasamyM
              Muthuraj Madasamy @Neil Schipper
              last edited by

              @neil-schipper

              This is the output after

              0fcc3186-c9cd-4c6d-a07c-fdd7e8b14fc5-image.png

              Neil SchipperN 1 Reply Last reply Reply Quote 0
              • Neil SchipperN
                Neil Schipper @Muthuraj Madasamy
                last edited by

                @muthuraj-madasamy

                I don’t want to have to shout but you really need to remove the check from . matches newline like in the image Alan provided

                It’s in the Search Mode box. See it?

                Muthuraj MadasamyM 1 Reply Last reply Reply Quote 0
                • Neil SchipperN
                  Neil Schipper @Muthuraj Madasamy
                  last edited by Neil Schipper

                  @muthuraj-madasamy said in Find a line and copy the next 10 lines:

                  ^.pem.\R(.*\R){10}
                  I used above search but still not selecting all the lines. As you see in the below image.

                  Hi. You didn’t notice that the expression that appears above is different from what you typed or pasted in, right? It’s missing two asterisks of the original. This is because when you paste text with asterisks in this discussion board, software converts the text to italics so people can make PRETTY TEXT. (The preview pane let’s you see this, but you have to look carefully.)

                  The way to prevent this is to use one of the two triple backquote techniquesas described in Please Read Before Posting.

                  Well, I didn’t notice either, and I was wrong to suggest you were using the wrong expression.

                  Muthuraj MadasamyM 1 Reply Last reply Reply Quote 0
                  • Muthuraj MadasamyM
                    Muthuraj Madasamy @Neil Schipper
                    last edited by

                    @neil-schipper said in Find a line and copy the next 10 lines:
                    Hi Neil
                    I understood that while responding the search word came default and i didn’t notice that you have taken that as a reference and providing the comments.

                    Can you see the image which i pasted there, in that one i have entered the correct format?

                    Thanks for spending time with me and i am a new user for notepad++.

                    Neil SchipperN 1 Reply Last reply Reply Quote 0
                    • Muthuraj MadasamyM
                      Muthuraj Madasamy @Neil Schipper
                      last edited by Muthuraj Madasamy

                      @neil-schipper

                      Thanks a lot. I got your point. the check point is creating trouble. I am able to make it now

                      2a750a5c-b9c1-48da-b8cb-6189902292a2-image.png

                      once again thanks a lot for helping to fix this

                      1 Reply Last reply Reply Quote 0
                      • Neil SchipperN
                        Neil Schipper @Muthuraj Madasamy
                        last edited by

                        @muthuraj-madasamy said in Find a line and copy the next 10 lines:

                        Can you see the image which i pasted there, in that one i have entered the correct format?

                        Yes, but I noticed it too late. The text in the image is small and I didn’t think to cross-check.

                        @muthuraj-madasamy said in Find a line and copy the next 10 lines:

                        fix this

                        I’m happy to hear it’s working.

                        Muthuraj MadasamyM 1 Reply Last reply Reply Quote 0
                        • Muthuraj MadasamyM
                          Muthuraj Madasamy @Neil Schipper
                          last edited by

                          @neil-schipper

                          Yes Neil…Thanks a lot…

                          Can you help me any tutorial info for using notepad++? I am new user and not much familiar with these operations.

                          Neil SchipperN 1 Reply Last reply Reply Quote 0
                          • Neil SchipperN
                            Neil Schipper @Muthuraj Madasamy
                            last edited by

                            @muthuraj-madasamy said in Find a line and copy the next 10 lines:

                            any tutorial info for using notepad++

                            I’m not sure what you are asking for or needing to know, but it is good if you become familiar with these:

                            https://npp-user-manual.org/docs/preferences
                            https://npp-user-manual.org/docs/searching/

                            Alan KilbornA 1 Reply Last reply Reply Quote 1
                            • Alan KilbornA
                              Alan Kilborn @Neil Schipper
                              last edited by Alan Kilborn

                              @neil-schipper

                              Wow, Neil, thanks for dealing with THAT, and sparing me. :-)

                              @Muthuraj-Madasamy

                              Additional good reference on regular expressions (the technique shown above to solve the problem) is found starting HERE.

                              1 Reply Last reply Reply Quote 1
                              • First post
                                Last post
                              The Community of users of the Notepad++ text editor.
                              Powered by NodeBB | Contributors