Use find and sed to find and replace text in multiple files
You can use find and sed commands in combination to find and replace text in multiple files. For example:
find . -name *.rb -exec sed -i 's/wrongtext/righttext/g' {} \;
this command finds 'wrongtext' string in all ruby files and replace it with 'righttext'.
Written by Andrea Puggioni
Related protips
1 Response
Small change but you don't need the .
, find defaults to the current directory
over 1 year ago
·
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Sed
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#