Recursively find and replace within a directory

Replaces all occurrences of a string recursively within a directory

Authored by: Anatoly
Brought to you by Warp, a free terminal reimagined to work like a modern app.
old_text
file_path
new_text

Command
Copy
grep -rl old_text file_path | xargs sed -i '' 's/old_text/new_text/g'
Tags