Find and replace links across all files in a vault

After adjusting my graph-view to only bubble up heavily backlinked nodes, I’ve noticed that some nodes are large even though they’re not very important.

Those are one-word notes (e.g. “deep work” or “job” or “ideas”) that I linked up because it was so easy[^1].

At this point, I care more about the quality of connections and decided to remove this type of noise from my vault.

After testing a few ways to “Find and replace” recursively across files and folders, and failing hard[^2], here’s what’s been working reliably without hiccups:

  1. Install Atom from https://atom.io/
  2. Open vault directory in Atom
  3. Use “Find” -> “Find in Project”
  4. Find all “[[Deep Work]]” with “Deep Work”
  5. Replace all

And done.

So, if you find yourself in need of removing links, consider using Atom and make sure you have made a backup before just in case.

[^1]: Those notes happen to be heavily backlinked because I got excited and went on a linking spree using the backlinks plugin a few months ago. I’ve since stopped using the automatic backlinking feature.

[^2]: I tried a bunch of bash/zsh/perl hacks found online and I messed up my vault so hard that I needed to swallow my pride, eat some humble-cake and use a UI.

31 Likes

Alexis, the only backlinks plugin I see is the one that shows the number os backlinks in the status bar. If you switch it off it won’t show that statistic anymore, but the backlinking process will continue for a simple reason: backlinks are inherent to the linking process.

Now, it is not my intention to teach grandma to suck eggs, and judging from your comments in the other thread you understand the concept of backlinks very well. So I must assume there must be a misunderstanding on my part, so please set me straight as to what you mean by the part of your comment I quoted.

2 Likes

@Klaas I shouldn’t speak for him, but I assume he means the regular Backlinks plugin.

In the Sidebar, it shows you “Unlinked mentions”. There it has a “Link” button to make the link for you. Which makes it easy (too easy, presumably) to make new links, quickly. I assume he means he has stopped using that “Link” button.

akaalias: That sounds like good advice to me. Be more thoughtful and careful about what gets linked, and you’ll end up with a more meaningful network over time. Thanks!

1 Like

Ah, OK, that was the misunderstanding on my side. Yes, I agree, using that generously is not a good idea. In fact, I never use it myself.

Thanks for jumping in :+1: :clap:

1 Like

I’m definitely going to take this into consideration. As I look at my own network, I notice that if I am trying to follow threads along ideas, I have a lot of cross-roads at links that are broad categories. And since these nodes are so large, they tend to grab your attention.

For example, if I look at some book notes that are about freelancing, I see some notes about freelancing and pricing. And that links to a note about a course I took. And then “Courses” is one of those one-word links you mention, and suddenly it branches out into a dozen different topics and now I’m on a note about music production, completely derailing the thought process. It’s generic, and less helpful.

It definitely seems like my current network is a huge inter-connected mess, rather than a tree of interesting branches.

My worst are: “Writing”, “Courses”, “Project”. Projects, for example, might be better as a tag, so I can treat it like a temporary status.

I wonder if we get better node filtering tools in the future, if this kind of large hub word will be easier to navigate anyway.

Edit: Although interconnected ideas are actually one of my main topics. Randomness, entropy, mingling of ideas. This research paper “The Entropic Brain” talks about how psychedelic drugs, for example bust open the default mode network of the brain and cause a lot of novel connections. Too much entropy, and it is meaningless chaos. Too little entropy, and you get stuck in narrow ruts of thought. (I’ll think more on this… ha!)

1 Like

No worries @Klaas! It’s exactly what @rigmarole refers to – The “Unlinked Mentions” in the backlinks sidebar which makes adding links very (for me too) easy.

At the same time, I’m glad I went on that backlinking spree and used that feature more than necessary. I wouldn’t have noticed what I wrote in the other thread :smiley:

1 Like

@klass, You said, “. . . but the backlinking process will continue for a simple reason; backlinks are inherent to the linking process.”

And, @rigmarole mentioned a “Link” button in the Sidebar that is related to unlinked mentions?

I am still a very new user of Obsidian and also very new to this type of application. I don’t see any “Link” button at all. I see where I can choose between views in the sidebar but no option for making a backlink. In fact, automatic backlinking would be wonderful!!

1 Like

First, to see the “Link” button, you need to have an Unlinked Mention. Meaning that if you are on the page “Hammerspoon”, and in another note you type the word “Hammerspoon” but don’t make it a link, it will show up in Unlinked Mentions.

Then, when you hover over the Unlinked Mention, you will see a little “Link” button appear.

unmentiond_backlinks

2 Likes

I have a lot of cross-roads at links that are broad categories .

Exactly that. I wonder for myself if they would be better as hashtags or nothing at all. I’m coming to the point where anything less than 3 words (“Courses”, “Work”, “Deep Work”, “Freelancing”) will likely not become its own note and even just maybe become a hashtag.

And then “Courses” is one of those one-word links you mention, and suddenly it branches out into a dozen different topics and now I’m on a note about music production, completely derailing the thought process. It’s generic, and less helpful.

“Generic” is really good word to describe the property. Following along or passing through generic nodes is less helpful because the connections are too broad. Surprisal (Information content) gets lost [^1]. As opposed to niche or long tail I reckon.

For example, I have one note about a project I worked on. If I add a link to “work”, that’s generic, obvious and is not bringing me to a new thought-process.

On the other hand, I have a whole niche section about “Victorian-era Oil Painting”, which reminded me of two books I had read (“Hackers and Painters” by Paul Graham and “The Victorian Internet” by Tom Standage.)

When I juxtaposed those three ideas through linking, my mind was bent in a completely new direction for over a week.

Although interconnected ideas are actually one of my main topics. Randomness, entropy, mingling of ideas. This research paper “The Entropic Brain ” talks about how psychedelic drugs, for example bust open the default mode network of the brain and cause a lot of novel connections. Too much entropy, and it is meaningless chaos. Too little entropy, and you get stuck in narrow ruts of thought. (I’ll think more on this… ha!)

Oh man. That is so on-point. In fact, I’ve described Obsidian as a psychedelic discovery tool in the original sense of the word (Greek Psyche + Greek dēlos ‘clear, manifest’). That’s because it can make visible (dēlos ‘clear, manifest’) what’s otherwise hidden.

That’s why I’m relatively obsessed with the graph-view.

And yes, I think what we’re talking about here is exploring the threshold between “bursting open the default mode network” and “too much entropy, and its meaningless chaos” – The right “dosage” of backlinks :joy:

[^1] Claude Shannon’s definition of self-information was chosen to meet several axioms:

  1. An event with probability 100% is perfectly unsurprising and yields no information.
  2. The less probable an event is, the more surprising it is and the more information it yields.
  3. If two independent events are measured separately, the total amount of information is the sum of the self-informations of the individual events.
1 Like

I saw your other thread about how valuable you think the graph view is, with thoughts about variables to change the view.

I’m beginning to sense the inkling of a plugin idea, where you could create temporary dynamic network links (like a list of Backlink connection rules, as a main example). And then - as a view - browse that temporary graph and see how it would look “if it were like this”. And while in that altered state ; ) you could set some of those links to be permanent.

But once the view is closed, no other permanent changes would have been made.

I think those kind of hypothetical, “counterfactual simulation” [Personal MBA] node graphs could be quite interesting.

1 Like

I don’t think that what @akaalias is proposing is a counterfactual simulation. He asks for a certain type of filter, viz. showing nodes with backlinks only, filtering out the forward links. I may be on the wrong track again.

1 Like

This is a wild idea and I very much want to try it out. If I understand correctly, it would alter the graph temporarily – and without changing the actual data – to show a different topology.

As a first ‘hack’, this could be done by simply randomizing how much weight a node gets. I might be able to put that together and report back. I’m moving places this week, but as soon as I get the time, I’ll report back :slight_smile:

1 Like

@Klaas, but I am proposing that, as a reply to his great ideas.

OK, I understand.

Thank you very much @akaalias, this worked very well!

Perfect, thank you. And regarding these unlinked mentions, It seems that it is unlikely to happen if all my notes use a UID such as today’s date or the YYYYMMDDHHmm format. May I ask how you identify your notes and do you regularly have unlinked mentions as a part of your use of Obsidian?

Sorry, I don’t understand your question.

But you do bring up an interesting point, that if you are using titles are are just dates, or unique identifiers, unlinked mentions won’t really do anything. It would almost be more interesting if unlinked mentions would look at body content - as well as titles - for potential links. hmm…

Any idea if this can be done in vscode

Atom, Find and replace across files.
I just started researching this, so I’m glad I found this Atom solution before diving too deep. I’ve had Atom for ages and I swear to the learning Gods, that is one program that persists on baffling me. Considering I’ve been at this for multiple decades, that’s rather embarrassing. Suppose I wanted to try this. PRECISELY which Atom package contains such functions. I search the install menu for “Find in Project” and get at least 100 packages. I’m sure one of these are the one you have installed. Atom, to the best of my understanding comes barely able to create a text file. From there you can customize until it washes your dishes and puts them away in addition to solving problems quantum computers will have difficulty addressing. Apologies. I’m snarky by nature, it’s joyful intentions frequently fail to reach the reader. Point is, in Atom, open my vault, click on anything, the find menu is (empty), so I’m assuming that’s another “package” that needs to be installed?

BTW: Using Notepad++ (The info link # points to the page bookmark down the page a bit, but it’s all relevant): https://www.makeuseof.com/tag/how-to-find-and-replace-words-in-multiple-files/#:~:text=Remove all the files you,All in All Opened Documents.
It can also be done in DOS, but I’ve forgotten how to do that decades ago.

2 Likes

2020-08-27T13:37:00Z
Atom, Find and replace across files

Ok… never figured this out in in Atom but it was easy in Brackets (although it too has a ton of packages installed, it may be one of those that allows this), and it appears VS Code handles it easily out of the box. @verma (VS Code also identified all the references in .obsidian\cache as well… might want to be careful with that. I’m still new to Obsidian but don’t automatically assume I already know inside sys files what I’m doing.

1 Like