shibz
September 5, 2002, 11:30am
1
Hi,
All of a sudden I landed in a strange problem.
I was working with my C source code in vi editor. I did a wq! and
when reopened, the file is full of "data".. I mean the text contents are gone!!.
I believe this is a file corruption. I have tried the -r option with vi, but no success.
Is there any way to recover the file. ??
Thanks in Advance...
Go to /tmp or /var/tmp, depending on where your vi temp files go, and look for the files that are your buffer. They may still be there.
You might get lucky and be able to recover something.
Always make a backup of your scripts, it might save you from this in the future. I had a DBA that lost 3 hours worth of work because his telnet window died.
If you have some kind of incremental daily backup to pull from if this is a script you have been working on for a few days.
i have $20 that says he actually did a X! enter enter.
heh. no need to be ashamed if you diid a X vs x. you just used crypt on your file. heh. it happens.
shibz
September 5, 2002, 11:51pm
4
That was G R E A T ...... Kudos !
BTW, I was unaware of X! feature. .. Infact, this has happened ( like Enter Key: ) in between and I come out of that with :q.
I continued the editing.. and finally saved it, it got "crypted"..
thanks a lot for identifying it..
BTW, is there any way to uncrypt it... ?
Once again, that was a great point...
shibz
September 6, 2002, 12:29am
5
Hi..
I could find the decrypt method...
cat crypted_file | crypt > output_file
This will ask for "Enter Key" to decrypt the file..
Enter the key and recover the file...
BTW, unfortunately, I typed lot of ^H to come out of "Enter Key:" in vi editor without knowing the crypt feature..
.... And I lost there...
You can also use crypt this way.
crypt < cryptfile.in > uncrypted.out
You may still be in trouble. Because I believe that you may not be able to recover what you typed as the password to crypt it.