Posts

Showing posts with the label replace

Search and replace a string in multiple text files in Linux

You can use this following command to search and replace a string in multiple text files in Linux: Original string: "Click here for filters." New string: "Click here for filters or full text search." find ./ -type f -exec sed -i 's/"Click here for filters."/"Click here for filters or full text search."/g' {} \;

Search for inline css in html file with atom using regex

In Atom or any text editor that supports regex search, you can use this to search for the inline css styles in a HTML file: style='[^']*' or double quote: style="[^"]*" Awesome!

Moodle - Change a moodle site's domain name

Image
To change your moodle site's domain name, for example from "old.domain.com" to "new.domain.com" you have to do following things: 0. Point new.domain.com to your moodle site's IP address 1. Go to the replace admin tool in your moodle (still running at the old.domain.com) and replace http://old.domain.com with http://new.domain.com in every record that has the url: http://old.domain.com/admin/tool/replace/ ( version >= 2.5) 2. Open /moodle/root/path/config.php and change the wwwroot to the new domain: $CFG->wwwroot   = 'http://new.domain.com '; 3. Change your nginx / apache configuration to retrieve server name as the new.domain.com (I use nginx ): ... server_name new.domain.com; ... 4. Restart nginx and php5-fpm: $ sudo service nginx restart $ sudo service php5-fpm restart 5. In addition, you can also clean the cache of your moodle: $ sudo rm -rf /moodle/data/path/cache/caches...