How can I find and replace all occurences of a word in all the files of a vault?

Things I have tried

What I’m trying to do

I am trying to find and replace all occurrences of a word in all the files of a vault?

For something like this I would use a text editor instead of Obsidian. In Windows, I use Notepad++ and use “Find in Files” and point it at my vault or subfolder.

If you’re on a Mac, I believe Atom is the popular text editor.

For either one, you should be able to find plenty of help on the web or YouTube for doing a find and replace across all files in a folder.

Backup your vault first.

1 Like

If you use a Linux OS, try this in the terminal.

find . -type f -name "*.md" -print0 | xargs -0 sed -i 's/foo/bar/g'

This will make replacements only on files with the .md extension
Replace foo with what is in the file and bar with the replacement text.

The plugin “Open in VSCode” will open the vault in the VSCode editor that will look very familiar if you are an Obsidian user. VSCode has both “Find in Files” and “Replace in Files” commands.

2 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.