I’m trying to find the number of times I wrote a specific word or phrase in a single note.
I think this feature could easily be implemented in the current “search file” (CTRL + F) or “search & replace” (CTRL + H) function for finding instances of a word or phrase in a note. It would just need to also count how many instances it finds and display it on-screen.
The ways I currently see to do this are:
Using the current “search file” menu via CTRL + F and going from instance to instance manually, counting until I reach the bottom of the note.
Copy-pasting the note into Microsoft Word or another program and finding the number of counts from there.
Creating a program in python or another programming language that auto-counts (I’m not very experienced in programming myself though so I have not tried this yet)
Hi, unfortunately I have not found a solution to this yet. The closest thing I have found is the Better Word Count plugin, but that only returns the number of words and characters in a single highlight, not number of specific words or phrases in a document. Otherwise I’ve been primarily using the workaround of copy-pasting into Microsoft Word or exporting to PDF whenever I’ve needed to find number of instances.
When using the search function, I would like a feature to count of the number of records found in a search. This would be a great help when comparing two or more searches to see if the count is different.
This could be acheived in a simular way to the way the community plugin “file explorer folder count” works.
I found a workaround! And I’d also like to add a big +1 because this feature - showing “Result x of y” when using CTRL + F within a note would be so much more user friendly.
Workaround: use the vault-wide search to search for the filename, then the search term.
Click the magnifying glass
In the vault-wide search, enter file:name_of_note "search term"
That view will show you the number of times your search term was found within the note. If your search term is rare, you can even omit the filename.
I understand that keeping conversations in single threads helps the community, but am I allowed to link to a similar thread that was opened around the same time? The reason being that while it is less well explained and has fewer replies, it has 24 likes.
Find count (x of y) is an absolutely essential feature of Obsidian that is missing. For a reference on how this feature should work, please refer to the in-editor Find and Replace feature of Visual Studio Code.
For example, when I search for a word “cat” within an obsidian page (ctrl+f), I can only go through the search result one by one. I do not know how many "cat"s there are in this document, which one I’m at, or have I been to the same result more than once already.
Like in the screen shot, when using in-document search, show a count of how many results there are in this page and which one I am currently at.
Secondary features that would also be nice:
Also highlight results that I’m currently not at.( in preview mode)
Definitely a +1 for this, I’ve been using Obsidian as my writing program of choice because it’s easy to organize, however not having something like this makes it a tad difficult to analyze my document for reoccurring phrases and the density of specific words or phrases throughout the document.
As a complete and utter Python beginner I needed a quick solution to this problem so I mocked up a small program which accepts absolute path to an .md file and then returns a list outlining all repeated words (n>=2) with info on how many times they’ve been mentioned.
There are a couple of caveats; I’m writting short form content so the program is designed to check the text located under a generic # Heading. Your .md file should look like this in order for my solution to be applicable:
Prius et infelix? Alter bene flerunt quoque illa, Dianae possent replent aequalis sed interea, et simul exit forma. Voverat quorum miserabile, defendere absens tibi manat Hyacinthon vobis. Sedes quod est et in perituraque videbam nec terrae, deos passaque velle simulacra similes!
Lorem markdownum aptas et diversis, refugis ipse quoque, ergo. Ore et amat, fatemur ego Caeneus sed servatusque, inpia increpuit eris. Inque convertor turbatum fuso. Date adiit aera criminis, inmoriuntur tenens dabitur, ales?
You can either run it by using your own Python interpreter after downloading the function module (f_md_repeats.my) with the script itself (md_script.py) or you can download the executable that will almost surely be recognized as a Trojan due to Python really not really being suited to .exe packaging.
Actually I’m quite shocked there is still no indication of results found in the status bar of Obsidian.
How does it apply to my case? There are notes exported from Dynalist and converted to tables: films watched, books read, etc. Previously I was able to easily filter out (get number of), say, things I liked by means of searching for “liked” keyword. Now I have either to copy/paste the contents to some third-party editor with required search verbosity like Sublime Text or to use some third-party terminal or GUI search application like RipGrep, DnGrep, Astrogrep. So counter-intuitive!
I’m adding a very big +1 for this, as it’s a feature I use often in text apps, word processors, and code editors. As a writing instructor, I’ve often suggested this feature in other programs to my students as part of their editing process—and many say that seeing the total has helped them to better perceive how their writing is repetitious.
Is the reason this hasn’t happened yet because of something specific to CodeMirror, difficulty deciding how to display the total results, or something else?
If it’s a question of how to display the total, another approach I’ve seen in notes apps is to display the “x of y total” within the search field. Or those numbers could be displayed only in the already-larger “Find and Replace” and omitted in the streamlined “Find” feature.
The easier way would be to add a temporary span in the status bar when there is a selection → 3 occurrences… maybe after 3 characters at least selected, if several occurrences are found, and an option to show only words occurrences. I will try to do it.