Linux - Replace string in all files recursively
Please use with caution!
- Finding the keyword:
grep -rs keyword
-r
- recursively
-s
- ignore error messages
- Search is case-sensitive - use
-i
to deactivate
- Replacing it:
find . -type f -exec sed -i 's/what/helloo/g' {} ';'
- is case-sensitive
Bonus: rename only files in the current directory
use the -maxdepth 1
option like find . -maxdepth 1 -type f [...]
.
Most recent Articles:
Notice Board 003: Progress is Progress
How to: Cisco ISE backup to SFTP repository with public key authentication
Dummy IP & MAC Addresses for Documentation & Sanitization
Deploying ISSO Commenting System for Static Content using Docker
Generate a Vanity v3 Hidden Service Onion Address with mkp224o