• Login
Community
  • Login

Find/copy specific line in all opened files

Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
4 Posts 3 Posters 1.6k 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.
  • M
    Markus Sulk
    last edited by Sep 27, 2022, 8:03 AM

    Let´s say that we have 75 files opened in notepad ++. There´s only in line in each of all these files that I´m interested in and it´s always the same line, line 74.

    I´d like to copy every line 74 in all opened files to a new txt file, is this possible? I´ve tried macros but without any success.

    If it´s easier, is it possible to search for line 74 in all opened files. If you search for anything and select “Find All in All Opened Documents” you´ll have the search results on the bottom of notepad ++. From there you can just copy the search result to an Excel file.

    1 Reply Last reply Reply Quote 0
    • G
      guy038
      last edited by guy038 Sep 27, 2022, 8:40 AM Sep 27, 2022, 8:37 AM

      Hello, @markus-sulk and All,

      Not difficult with regex !

      So :

      • Open the Find dialog ( Ctrl + F )

      • Untick all box options

      • SEARCH (?-s)\A(.*\R){73}\K.*\R

      • Select the Regular expression search mode

      • Click on the Find All in All Opened Documents button

      Et voilà !!


      Notes :

      • If the 74th line is empty, it will output that empty line !

      • Any file, with less than 74 lines, is not outputted, too !

      Best Regards,

      guy038

      M 1 Reply Last reply Sep 27, 2022, 9:27 AM Reply Quote 4
      • M
        Markus Sulk @guy038
        last edited by Sep 27, 2022, 9:27 AM

        @guy038 , amazing!
        That was just fantastic, made my day, and week!
        Thanks alot!

        1 Reply Last reply Reply Quote 1
        • S
          Selva TN
          last edited by Jun 28, 2023, 7:34 AM

          @guy038 Thank you

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