Community
    • Login

    How to find a line by a tag and remove data from line.

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    4 Posts 2 Posters 426 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.
    • Ashley HoogenboomA Offline
      Ashley Hoogenboom
      last edited by

      I am trying to find all lines that start with T: and remove the report code and date, leaving only the description.

      Sample of what file looks like to start:

      T:BKMJALL DAILY MAINTENANCE JOURNAL ALL USERS/APPS 2018/01/02
      Y:1
      C0:BKMJALL
      D:1/5/2018 8:51:56 AM
      T:GL5324P UNPOSTED ITEM LISTING - DETAIL 2018/01/02
      Y:1
      C0:GL5324P

      Expected outcome:

      T:DAILY MAINTENANCE JOURNAL ALL USERS/APPS
      Y:1
      C0:BKMJALL
      D:1/5/2018 8:51:56 AM
      T:UNPOSTED ITEM LISTING - DETAIL
      Y:1
      C0:GL5324P

      Is there a way to do this with notepad++?

      Thank you!

      Neil SchipperN 1 Reply Last reply Reply Quote 0
      • Neil SchipperN Offline
        Neil Schipper @Ashley Hoogenboom
        last edited by

        @ashley-hoogenboom Hello.

        If your data is as well behaved (uniform) as the samples suggest, this should meet your need:

        Ctl-h (replace dialog)
        Search Mode=RegExp ; box to the right not checked
        F: (?<=T:)(\w+\h)(.+)(\h\d{4}/\d{2}/\d{2}$)
        R: \2
        Replace all

        There are actually quite a few subtly different interpretations possible (based on characteristics of the text to remove, and, amounts of whitespace) so carefully check lots of records for false positives (too much removed) or false negatives (too little).

        Ashley HoogenboomA 1 Reply Last reply Reply Quote 3
        • Ashley HoogenboomA Offline
          Ashley Hoogenboom @Neil Schipper
          last edited by

          @neil-schipper Thank you so much, that worked perfectly! I have a huge project ahead of myself and this really helped! Thank you!

          Neil SchipperN 1 Reply Last reply Reply Quote 0
          • Neil SchipperN Offline
            Neil Schipper @Ashley Hoogenboom
            last edited by

            @ashley-hoogenboom Appreciation appreciated.

            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