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:02You begin editing the file " text.doc" by typing:ed text.docAn 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:02The 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.
text.jou Jun 7 1978 10:36To be safe, make a copy of the journal file:
cp text.jou text.recoverYou 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:
Now execute the recovery file by typing:
- enter screen mode ( c ),
- go to the end of the file (gold 4),
- hit space and return,
- enter the control character ctrl-Z by hitting in sequence:
gold(26 is the ascii value for ^Z.)
3
26
gold
- enter "ex" after the ^Z. This will cause an exit and save the document when you execute the recovery file.
- save and close the recovery file.
ed text.doc < text.recoveryYou will see the replay of your editing session and the editor will save the final version and close.