I have been looking a better way to replace certain string in a file accross many folders under one directory and come up with two sultions.
$ find . -name "*.html" -print | xargs sed -i 's/base_site.html/base.html/g'
$ grep -lir "base.html" * | xargs sed -i 's/base.html/base_site.html/g'
The differences are find-- looking for files based on the file names, means it only modifies certain type of file
grep-- looking for files based on the content of the file, any files contains "base.html" string will be replaced.
Find and replcae across multiple files in linux
Subscribe to:
Post Comments (Atom)
Datatable static image not found on the server
When you use ```datatables.min.css``` and ```datatables.min.js``` locally, instead of datatables CDN, you may have encountered that ```sort...
No comments:
Post a Comment