Community
    • Login

    separate to a NEW file

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    4 Posts 4 Posters 574 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.
    • Mostafa KamalM Offline
      Mostafa Kamal
      last edited by

      how can i separate last 3 words from 200k rows list to a new file ?
      i mean 470124, here i want to last 3 digits to a new file,

      dr ramaanandD Terry RT PeterJonesP 3 Replies Last reply Reply Quote 0
      • dr ramaanandD Offline
        dr ramaanand @Mostafa Kamal
        last edited by

        @Mostafa-Kamal Please give us the input text or string and the desired output

        1 Reply Last reply Reply Quote 0
        • Terry RT Offline
          Terry R @Mostafa Kamal
          last edited by Terry R

          @Mostafa-Kamal said in separate to a NEW file:

          i mean 470124, here i want to last 3 digits to a new file,

          You use “words” but your example suggests 3 characters. If so then first make a copy of the file as the copied file will contain the 3 characters per line.
          Find What:(?-s)^.*(...)$
          Replace With:\1

          The search mode must be “regular expression”, click on “Replace All” to change the file content.

          Each DOT (.) character refers to a single character position in the file. The last 3 characters are saved into a group (1) which is written back. The extra characters on each line are effectively removed.

          Terry

          1 Reply Last reply Reply Quote 2
          • PeterJonesP Offline
            PeterJones @Mostafa Kamal
            last edited by

            @Mostafa-Kamal ,

            if it’s a one-time action, @Terry-R’s suggestion is spot on, and you don’t need to read my post.

            However, if it’s an action you are going to take a lot, I would suggest recording a macro:

            1. Macro > Start Recording
            2. Search > Mark
              • FIND WHAT: \d{3}$ (this assumes it’s always a digit, like in your example; if it is just the last three characters, whether it’s digit or not, then .{3}$ instead
              • Uncheckmark Bookmark line
              • Checkmark Purge for each search
              • Mark All
              • Copy Marked Text
              • Clear all marks
              • Close
            3. File > New
            4. Edit > Paste
            5. Macro > Stop Recording
            6. Macro > Save Current Recorded Macro
              • Give it a name that makes sense to you (CopyLastDigitsToNewFile or something)
              • Give it a keyboard shortcut if desired.

            From now on, you can run the macro to copy those last digits/characters to a new file.

            1 Reply Last reply Reply Quote 2

            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