Bring back a file changed with sed


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Bring back a file changed with sed
# 1  
Old 11-17-2012
Hammer & Screwdriver Bring back a file changed with sed

Hello everbody

I changed one of my important files with a false sed statement by mistake now I lost my file and I hope I could bring it back

what I did was:

Code:
sed '/^..//' a > myfile

myfile should have been another file like b ot something I know I also forgot to place an 's' to the beginning.

Is it possible to bring myfile back now it is emty it was an output file of a program which worked for 2 days Smilie Smilie Smilie
# 2  
Old 11-17-2012
Quote:
Originally Posted by miriammiriam
Code:
sed '/^..//' a > myfile

I don't think is there any reason your input file deleted/changed because of your script. It will give error.

here you are performing operation on file a. so it won't change any thing to file a.
# 3  
Old 11-17-2012
I know, the file a did not changed of course. I want to bring back the changed file is which is in this case "myfile" not a.
# 4  
Old 11-17-2012
If your system administrator made backups of your files, you can ask to havemyfile restored to the value it had when it was last backed up before you recreated it. Otherwise, it is probably gone.

If no one has overwritten the blocks that were freed when you recreated the file, the data might still exist on unallocated blocks on the the hardware underlying that filesystem. If you are that lucky and it is EXTREMELY important that you recover that data, immediately unmount that filesystem and then find an expert to help you search the free list for your data.
# 5  
Old 11-17-2012
Ok I see, I could not find any backup file but olnly find a previous backup file which is what I do not need. Thank you I think it's gone Smilie
# 6  
Old 11-17-2012
Quote:
Originally Posted by miriammiriam
Code:
sed '/^..//' a > myfile

Your code and description doesn't match.Smilie



Quote:
Originally Posted by miriammiriam
myfile should have been another file like b ot something I know I also forgot to place an 's' to the beginning.

Is it possible to bring myfile back now it is emty it was an output file of a program which worked for 2 days Smilie Smilie Smilie
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. Red Hat

Bring tape paths back up in Redhat 5.4

Hi Folks, Looking for some assistance here on a Dell server connected to a Dell tape robot with Redhat 5.4 and Netbackup 6.5. Netbackup thinks the tapes are all present and working, but they are not - we lost the internal encryption keys earlier but think that they are reinstated as the... (0 Replies)
Discussion started by: gull04
0 Replies

2. Shell Programming and Scripting

Script to echo "File permissions or ownership changed from required " when accidentally changed.

Hi All, I have to work in the late nights some times for server maintenance and in a hurry to complete I am accidentally changing ownership or permission of directories :( which have similar names ( /var in root and var of some other directory ).:confused: Can some one suggest me with the... (1 Reply)
Discussion started by: shiek.kaleem
1 Replies

3. Solaris

DNS service is in maintenance mode. How to bring it back to online mode?

:confused: when i tried to look the status of DNS-client, it is in maintenance mode..... Please tell me how to bring it back to online mode...PLEASE TELL ME STEP BY STEP.... PLEASE... :wall: (2 Replies)
Discussion started by: vamshigvk475
2 Replies

4. Shell Programming and Scripting

how to get list of files changed by sed while replacing

Hi We have a shell script to find a string in a large set of files and replace it using the sed command.in the same time we also want to store the list of files it checked. *** The existing script is as below #!/bin/bash #1 _r1="inst_group=ems7770" _r2="inst_group=dba" # Escape path... (4 Replies)
Discussion started by: sabkan
4 Replies

5. Solaris

How to bring back/restore root account?

Hi all, I have a problem, when I use script with 'expect', accidentally I was deleted root account by "userdel root". Unfortunately, it works, because no other root user login on it. Solaris document said that root cannot delete root, but in my case it works because it deleted by script, not... (7 Replies)
Discussion started by: joash
7 Replies

6. Linux

Bring back a deleted partition

I deleted my partition on a test server and want to bring back the partition. I have not rebooted yet, so system is operational. I have the /proc/partition major minor #blocks name 8 0 195359960 sda 8 1 1044224 sda1 8 ... (2 Replies)
Discussion started by: photon
2 Replies

7. Shell Programming and Scripting

Partial Column extraction/Process/Repasting changed Columns back to Source file

I have the following requirement. file1.txt (this could contain 5 million rows) ABC 1234 XYZ .... (3000 bytes) QRD 4612 GHT .... (3000 bytes) I need to create file2.txt 1234 4612 I have a EAI process to change file2.txt into file3.txt 4555 3743 Then I would have to use... (0 Replies)
Discussion started by: jostul
0 Replies

8. UNIX for Dummies Questions & Answers

Bring back removed files

Dear People I have removed some of my files and directories( by using rm and rmdir commands) by mistake. I wish to bring them back. How is it possible?( I am using solaris 2.6) best regards Reza Nazarian:( (2 Replies)
Discussion started by: Reza Nazarian
2 Replies
Login or Register to Ask a Question