I want to search and replace a string in all files within one directory.
For example, I have the following text in all my Markdown files:
I want to replace that piece of text in all files with
Read more →.
- Go to the directory, and use
rg "Read more"
- Pipe all files that ripgrep finds to sed and replace the text:
rg "Read more" --files-with-matches | xargs sed -i "s/Read more/Read more →/g"
Read other posts