Global (Mass / Vault-wise) search & replace

+1

rename tag is a useful function

1 Like

There are already plugin for renaming tags: tag wrangler.

2 Likes

So far I’ve been opening my Obsidian vault in Atom to do global search + replace. I saw just now that Atom is going to be discontinued, if I understood that correctly. So has there been any update on doing this in Obsidian?
Thanks :slight_smile:

2 Likes

I use a shell script for this bulk replacement

on MacOS:

#!/bin/sh
ORIG='text_to_be_replaced'
REPL='new_text'

find . -name '*.md' | xargs -r sed -i '' "s/$ORIG/$REPL/g"
4 Likes

Thanks, I’ll give that a try. I’m on Linux Mint, but I think I’ve used something like that before.

How do I limit that to certain folders with subfolders/recursively?

Based on my understanding, the . means current folder where the shell script is executed. And you can replace it with some other path.

Second, find will go through all subdirectories recursively by default.
And if you want don’t want find to go into the subdirectory, you can use -maxdepth to limit the maximum depth that find will go.

find . -maxdepth 1 -name '*.md' | xargs -r sed -i '' "s/$ORIG/$REPL/g"

Oh, one more very important thing:

Make a BACKUP first.

when the script runs, there is no returning back.

2 Likes

Haha yeah, backups are good, but thanks for the reminder :slight_smile: That’s kinda why I was hoping for an implementation in Obsidian like it is in Atom as I find that harder (not impossible though lol) to screw up.

Thats exactly the reason I have SVN installed.
I commit my notes everyday, just in case I have to fallback.

But even otherwise , SVN + Obsidian give you insight how the note/s have emerged/branched over time.

I use freesync to backup obsidian vault everyday to a specific folder, so that the time machine will continue the backup work.

1 Like

I just store my notes folder in Nextcloud. Nextcloud provides the version control.

2 Likes

+1 for a global search and replace (without going to VS Code or the like).

1 Like

+1 for search and replace!!!

1 Like

+1 for global search and replace! thanks~

1 Like

+1 Long-term users are bound to find better systems and make changes to the structure of their Obsidian vault - without a global replace function this becomes pretty difficult.

2 Likes

I use the tool “grepWin” in Windows (10) Explorer for such purposes. Right click on the note-folder, search and replace - done! I have backups of all my notes, so there’s no worry. Works also with YAML Metadata.
https://tools.stefankueng.com/grepWin.html

1 Like

Here is the solution to this issue with Sublime Test app: Find + Replace in multiple files - Technical Support - Sublime Forum

1 Like

Would love to see this, with support for regular expressions like in VScode; I’m aware I can open my vault in VScode, but it would be a major improvement for myself if this was supported in Obsidian.

3 Likes

+1 For search & replace, please!!!

4 Likes

It seems that Atom.io is no longer available since december the 15th 2022
:frowning: