Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Replacing Systemwide Reference

by artist (Parson)
on Apr 07, 2009 at 19:42 UTC ( #756124=perlquestion: print w/ replies, xml ) Need Help??
artist has asked for the wisdom of the Perl Monks concerning the following question:

We changed the server so I have to replace the references of prefix.hosta to prefix.hostb system wide. What would be the best way to do it? I also want to make sure, I don't do anything wrong accidently.

--Artist

Comment on Replacing Systemwide Reference
Download Code
Re: Replacing Systemwide Reference
by Fletch (Chancellor) on Apr 07, 2009 at 19:46 UTC
    • Find all instances of prefix.hosta
    • Change them to prefix.hostb
    • Profit!

    You're going to have to give a bit more to go on. Do you mean in all files? All system configuration files? (If so a hint at the OS might help) Do you mean in all HTML documents under directory foo?

    The cake is a lie.
    The cake is a lie.
    The cake is a lie.

      The content is the unknown part. Mostly it should referred in application files, html ,js , config files etc, but I cannot say absolutely sure.

      --Artist
Re: Replacing Systemwide Reference
by jethro (Monsignor) on Apr 07, 2009 at 19:50 UTC
    The best way may be first telling us what system, which server and many other details. Absent that I can only guess that find / -type f -print | xargs grep 'prefix.hosta' might find all occurences of that string on your hard disk. Blindly substituting them per script is not advisable as you could find false positives in binaries or text documents
Re: Replacing Systemwide Reference
by ELISHEVA (Prior) on Apr 07, 2009 at 20:55 UTC
    I also want to make sure, I don't do anything wrong accidently.
    • If you really are doing a system wide change, you will save yourself a lot of pain by doing a backup of your system before you try such a global change. That way if you clobber a really important file, you can get the original, pre-change, version back.
    • Better yet, if all the files that you want to change are under version control, then do the changes in a working copy: check out a clean up-to-date working copy, make the changes, inspect the result, and if you are happy with it, commit the changes.

    Best, beth

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://756124]
Approved by planetscape
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (6)
As of 2014-12-27 08:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (176 votes), past polls