HostMonster Web Hosting Help

Find and replace across multiple files


How to edit several individual pages to replace a string of text e.g. update the phone number on the footer of every page on your site.


With SSH command line access, you can choose from the following:
          * perl -pi -w -e 's/search/replace/g;' *.php
            -e means execute the following line of code.
            -i means edit in-place
            -w write warnings
            -p loop
          * find ./ -type f -exec sed 's/search/replace' {} \;
Knowledgebase Article 58,582 views bookmark tags: command ssh (updated 2036 days ago)

Was this resource helpful?

Did this resolve your issue?

Please add any other comments or suggestions about this content:

Recommended Help Content

I am trying to edit my web page and I have no idea how to? I need to know how to go into the site and fix it. My webpage has a error in the first paragraph. I don't know how to fix it? Can you help? (updated 971 days ago)
Knowledgebase Article 157,815 views tags: edit html upload webpage

How do I import a database using command line? (SSH) (updated 1011 days ago)
Knowledgebase Article 384,199 views tags: command database import line mysql phpmyadmin ssh

How to restore individual files or folders with the Site Backup & Restore tool (updated 1357 days ago)
Knowledgebase Article 89,749 views tags: backup files folders restore site

Related Help Content

This article will instruct you how to export a database from the command line (SSH). (updated 600 days ago)
Knowledgebase Article 426,764 views tags: database mysql ssh

Is SSH/Shell access enabled by default? (updated 1186 days ago)
Knowledgebase Article 319,654 views tags: bash command line secure shell ssh

This article will show a way to protect specific pages of your website with SSL. This may have benefits for SEO and can be used on pages that contain forms, shopping carts or any other page where users might enter sensitive information. (updated 3 days ago)
Knowledgebase Article 123 views tags: htaccess pages specific ssl

How to Transfer hosted files from old host to via ssh. Your old host must have SSH access to perform this move. Using SSH to transfer files to HostMonster (updated 2010 days ago)
Knowledgebase Article 87,883 views tags: file host site transfer

If suddenly when you go to your page, you get nothing on the page. You can still get HTML to display, just not PHP. To serve HTML pages to browsers, we don't associate the Apache processes with your 2 (updated 2041 days ago)
Knowledgebase Article 60,604 views tags: page php

This article explains how to find the database in use by a Wordpress site. (updated 13 days ago)
Knowledgebase Article 422 views tags: database find wordpress

This article explains error pages and how they can be customized. (updated 809 days ago)
Knowledgebase Article 107,992 views tags: customize pages

How to generate and use SSH Keys (updated 469 days ago)
Knowledgebase Article 28,586 views tags: dedicated ssh