hjajeg
Last Updated: December 26, 2018
·
1.127K
· 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

1036

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

over 1 year ago ·