Community

    • Login
    • Search
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

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

    Help wanted · · · – – – · · ·
    2
    4
    80
    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 Hoogenboom
      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 Schipper 1 Reply Last reply Reply Quote 0
      • Neil Schipper
        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 Hoogenboom 1 Reply Last reply Reply Quote 3
        • Ashley Hoogenboom
          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 Schipper 1 Reply Last reply Reply Quote 0
          • Neil Schipper
            Neil Schipper @Ashley Hoogenboom last edited by

            @ashley-hoogenboom Appreciation appreciated.

            1 Reply Last reply Reply Quote 1
            • First post
              Last post
            Copyright © 2014 NodeBB Forums | Contributors