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...
-
1. locate where is suexec by running the following: whereis suexec return suexec: /usr/sbin/suexec /usr/share/man/man8/suexec.8.gz 2. rename...
-
Case One The following procedure is good if you have admin account for Internal workspace. 1. Log into Internal workspace with admin accou...
-
Step 1. Install Oracle XE 11g 1. Download Oracle XE (oracle-xe-11.2.0-1.0.x86_64.rpm.zip) from Oracle official website. You need an accoun...
No comments:
Post a Comment