7. File Recovery

During file editing, the editor maintains a journal file of the editing session. The journal file is useful for recovering work that would otherwise be lost in the event of a system crash or similar calamity.

To recover from a journal file, restart the editor on the edited file as before, but with the input directed from the journal file. You will see the editing session replayed.

Example:

Suppose in your directory there is a file called "text.doc":
text.doc     Jun 6 1978   8:02
You begin editing the file " text.doc" by typing:
ed   text.doc
An hour into your editing session, the system crashes at 10:37 AM.

Upon resumption, you would notice there are two files:

text.doc     Jun 6 1978   8:02
text.jou     Jun 7 1978   10:36
The first file contains the original contents of the " text.doc" file prior to the crashed editing session. The " text.jou" file contains a record of the edits made during the recent session.

To be safe, make a copy of the journal file:

cp   text.jou   text.recover
You can now recover the edits from the interrupted editing session as follows:

Begin the recovery process by editing the "text.recover" file to put a control-Z and "exit" at its end so that the file will be saved upon recovery.

Specifically:

  1. enter screen mode ( c ),
  2. go to the end of the file (gold 4),
  3. hit space and return,
  4. enter the control character ctrl-Z by hitting in sequence:
    gold
    3
    26
    gold
    (26 is the ascii value for ^Z.)
  5. enter "ex" after the ^Z. This will cause an exit and save the document when you execute the recovery file.
  6. save and close the recovery file.
Now execute the recovery file by typing:
ed   text.doc   <   text.recovery
You will see the replay of your editing session and the editor will save the final version and close.


Back to EDT                     SourceForge.net Logo