Sed command went super wrong, please help
Hi everyone, I'm very new at GNU Linux, so I used a sed command wrongly, I ended up messing all my most important files, the idea was to change all special characters in the file's names, but ended up changing all special characters inside the files.
This is the command: Code:
sed -i 'y/αΑΰΐγΓβΒιΙκΚνΝσΣυΥτΤϊΪρΡηΗ/aAaAaAaAeEeEiIoOoOoOuUnNcC/' Docs/superimportant_files/* I need to undo this, but I can't. I need big help. |
I haven't done anything else with those files, at all, since the dumb accident.
|
The attempt to rerun the sed -i with swapped sides will likely fail, because it cannot distinguish between the produced destination characters and the destination characters that have already been there.
Restore from backup! |
I'd start by making backups of what you do have, searching for any former good copies of the files, and setting them all aside so as to not cause more troubles.
Then I'd try the reverse of that command only on a copy of one file and see if it fixes it: Code:
sed -i 'y/aAaAaAaAeEeEiIoOoOoOuUnNcC/αΑΰΐγΓβΒιΙκΚνΝσΣυΥτΤϊΪρΡηΗ/' <filename> |
You don't have a backup to restore from, then?
Backup your files before you try anything else. man sed says Code:
-i[SUFFIX], --in-place[=SUFFIX] Code:
sed -i.bak 'y/aAaAaAaAeEeEiIoOoOoOuUnNcC/αΑΰΐγΓβΒιΙκΚνΝσΣυΥτΤϊΪρΡηΗ/' Docs/superimportant_files/* |
Both pdf and doc files are compressed, not plain text, so the damage is more than simply cosmetic. I agree with the sentiments in post #3.
|
All times are GMT -5. The time now is 04:38 PM. |