How to find a line by a tag and remove data from line.
-
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:GL5324PExpected 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:GL5324PIs there a way to do this with notepad++?
Thank you!
-
@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 allThere 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).
-
@neil-schipper Thank you so much, that worked perfectly! I have a huge project ahead of myself and this really helped! Thank you!
-
@ashley-hoogenboom Appreciation appreciated.
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