Actually the odd thing about this is use of .bak to save the original while working on the original copy instead of using original.new as a scratch pad to work on the new version!

One consideration is to the extent possible, leave the system in a "known state" even if whole O/S bombs or program bombs, meaning even some function which the modification program called "bombed" and process was killed.

So in general, I would recommend making a copy of the original file and modify that "new copy" until we are happy with it. Leave the original alone! The last thing to do is to close the ".new" copy, unlink the original, then rename the ".new" version to the original name. The idea is to make the "time window" where the machine is in an unknown state (between "old" and "new") as small as possible.

The "yeah, butt's" with this are legion. On some O/S's, I can unlink a file, put a new file with same name in directory and folks that have that say old.dll open continue to use the old version because once a file is open, the name is irrelevant...the program is using a file handle, not a name in a directory. New programs that start will get new.dll. A good Windows installation program will register what is called a "run-once" program. This program runs if the OS reboots during the install to clean things up. The installer will remove this "run-once" deal after all it wanted to do was successful (so it doesn't run on the next re-boot).

Already talked too long about this, but there are some definite "yeah, butt's" to be considered when modifying files. I would move "old-previously-modified" files to some area where they are just history of no real consequence after some period of time. And then periodically delete them.


In reply to Re^2: Find and Replace from File List by Marshall
in thread Find and Replace from File List by PyrexKidd

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.