Community
    • Login

    How to display only rows that contain the number "300000"

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    3 Posts 3 Posters 18.4k Views 2 Watching
    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.
    • djmcgD Offline
      djmcg
      last edited by

      How to display only rows that contain the number “300000” and delete the remaining rows.

      I have lot of rows wit some information and it`s ended some number example ;3876219
      How to display only rows that contain the number “300000”

      Scott SumnerS 1 Reply Last reply Reply Quote 0
      • Scott SumnerS Offline
        Scott Sumner @djmcg
        last edited by

        @djmcg said:

        display only rows

        As far as displaying only those lines goes, you are probably out of luck. Deleting lines that don’t contain a certain thing can be accomplished, but in a roundabout way:

        You can do it with standard Notepad++ but for this task I might recommend the LineFilter2 plugin…

        The easiest way to do it in Notepad++ itself is probably to mark the lines that contain 300000 and then copy them to a new tab. Invoke the Search (menu) -> Mark… dialog and set up the fields. Make sure to tick Bookmark line. Run it and all of the lines that match your desired text will get “bookmarked” with a round blue ball in the left margin. Next invoke Search (menu) -> Bookmark -> Copy Bookmarked Lines. Then paste the clipboard contents (containing only lines with your desired data) somewhere else (e.g., a new tab).

        There are other ways but that may be the simplest to explain and execute…but wait, maybe this is even easier:

        Do a FInd All in Current Document for your data. The right-click in the Find result panel’s whitespace area and choose Select All. Again right-click and choose Copy. Then paste the clipboard contents (containing only lines with your desired data) somewhere else (e.g., a new tab).

        You’ve got options! :-D

        1 Reply Last reply Reply Quote 0
        • guy038G Offline
          guy038
          last edited by guy038

          Hello, @djmcg, @scott-sumner and All,

          I said, in that other post, below, that finding all files, which do not contain a specific string, was not easy, with our Boost regex engine and that we need to use a work-around to get the right results. However, we can easily build a regex which find all lines of files, which do not contain a specific string ! And, then, delete them, as and when :-))

          https://notepad-plus-plus.org/community/topic/14870/regex-find-all-files-that-do-not-contain-some-words/2


          In your example, this specific string seems to be the number 300000, preceded by a semicolon

          So, the regex S/R, below, should keep only lines containing the string ;300000 :

          SEARCH (?-s)(?!.*;300000)^.*\R

          REPLACE Leave EMPTY

          OPTIONS Regular expression and Wrap around checked

          => It remains, only lines that contain the string ;300000. Et voilà !


          Notes :

          • The first part (?-s) modifier means that dot will match any standard character, only and NOT the line breaks

          • The last part ^.*\R is the range of characters to search for, that is to say, all characters of a line, even empty, along with its End of Line character(s)

          • And, thanks to the middle part (?!.*;300000), which is a negative look-ahead, this search will be true, ONLY IF the string ;300000 cannot be found, from beginning of line, in the current line scanned

          • And, as the Replacement part is empty, these lines are simply deleted


          As you see, you’ve got 4 solutions, to get the job done :

          • With the LineFilter2 plugin

          • With bookmarks

          • With the Find result panel

          • With regex S/R

          Enjoy N++ !!

          Cheers,

          guy038

          1 Reply Last reply Reply Quote 1

          Hello! It looks like you're interested in this conversation, but you don't have an account yet.

          Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

          With your input, this post could be even better 💗

          Register Login
          • First post
            Last post
          The Community of users of the Notepad++ text editor.
          Powered by NodeBB | Contributors