Last Updated: September 09, 2019
·
1.439K
· apug

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'.

1 Response
Add your response

Small change but you don't need the ., find defaults to the current directory

over 1 year ago ·