Kaushik J
Kaushik J

Reputation: 1072

Jupyterlab - find and replace globally ( all files and in all directories )

Is there any way to find and replace text string automatically in all folder's files? similar to what we get in sublime text, VS code etc

Upvotes: 2

Views: 1263

Answers (2)

krassowski
krassowski

Reputation: 15439

You can install jupyterlab-search-replace extension, for example with pip:

pip install jupyterlab-search-replace

and the required ripgrep, for example on Ubuntu:

sudo apt-get install ripgrep

If you use a conda environment you can just install both with:

conda install -c conda-forge jupyterlab-search-replace ripgrep

For up-to-date installation instructions see the GitHub repository of the extension.

This extension requires JupyterLab 3 or newer.

Demonstration

Upvotes: 4

Michael Kopp
Michael Kopp

Reputation: 1711

In JupyterLab you can open a terminal. Depending on the OS you use, you can use the tools from that OS to do the job. On Linux for example you can use find and sed to replace:

find path/to/folder -type f -exec sed -i 's/replace this/with this/g' {} \;

Other than that I do not think that this is a built-in functionality in JupyterLab.

Upvotes: 2

Related Questions