Profile picture Schedule a Meeting
c a n d l a n d . n e t

Use modern CLI tools to search and replace text in files

Dusty Candland | | cli, ripgrep, sd

Searching and replacing text is easier with modern CLI tools. I'll show you how to use ripgrep and sd to search and replace text in files.

Check for the text in files. This is case insensitive.

ripgrep -li old_text

Replace the text in files. This will replace the text in the files, in place.

ripgrep -l old_text | xargs -n 1 sd old_text new_text

Webmentions

These are webmentions via the IndieWeb and webmention.io. Mention this post from your site: