Tail with filter
-
Hi,
is there an option to use tail with a filter? So only lines with a specific text will appear in the result.
BR
Franz -
@Franz ,
Natively, no. Notepad++ doesn’t have a “filter” feature that just hides text without deleting it.
There might be some plugins that do a “filter”-like feature, but I don’t know which they are, and it would be doubtful if they’d work correctly with the Monitor (tail -f) feature of Notepad++. If someone else knows of a way, they can chime in.
As a workaround: assuming you have the
logfile.logopen as the current file (doesn’t need to be in “tail” mode, but it can be): Run > Run…powershell -command "Get-Date -Format 'MM/dd/yyyy' >> '$(CURRENT_DIRECTORY)\filtered.log' ; Get-Content -Path '$(FULL_CURRENT_PATH)' -Wait | Select-String -pattern '^[AEOIU].*$' >> '$(CURRENT_DIRECTORY)\filtered.log';"and then File > Open
filtered.log, and set Monitor (tail -f).This example filters your original
logfile.logfor any line in that starts with a vowel, and pipes it intofiltered.login the same directory; when you then openfiltered.login tail-mode, only the text that matches the filter will make it intofiltered.log, which you are watching as it goes, so it gives you the basic effect, even though Notpead++ doesn’t do it natively.If you want something other than “starts with a vowel”, change the
'^[AEOIU].*$'from the command I gave to a valid powershell regular expression (make sure to keep it wrapped in single quotes, like the example regex was). (In this forum, we’re good at Notepad++ regular expressions; but powershell regex are not our area of expertise, so, if you need help with the powershell regex aspect, this forum probably isn’t the best place to ask)
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