It changed all my LIBRABRIES since i used -- perl -p -i -e 's/^M//g' *
Is there some way to revert this from my libraries . Does any revert command exits for the Control M in libraries. I believe my libraries are corrupted now.
Sorry, but in this case a R&R (reboot and restore) is called for.
It is not - not even theoretically - possible to revert this because it is not clear where the "^M"s have been: You have EOLs which are preceeded by a ^M and EOLs which aren't. It is easy to search for the ones which are and change them - like you have done. But now you have only EOLs which aren't preceeded by ^M and if you now add a ^M before each of them your libraries will perhaps be as corrupted as they are now because there will be any number of superfluous ^Ms in there.
I hope this helps - if only to avoid it the next time.
As a minor correction to what bakunin wrote, actually ^M doesn't stand for carriage return, it means the character M at beginning of line (i.e. beginning of file or immediately after a line feed).
Hm, I would think it depends on what the poster has really typed when he entered the perl statement's substitution.
If he pressed ^V and then hit Enter then ^M should represent \015.
But if he actually only typed a caret (or circumflex) followed by upper case M,
yes than it just represents those Ms.
Maybe he should pipe his statement from the history into an octal dump to make sure?
I never questioned that.
As the other poster already said, it's time to role the restore from the backup.
Just an aside,
if you (the thread issuer) like me have your filesystems on LVM volumes (yes I do have a separate lv_usr)
there is a neat feature that can be used for rolling back quickly from an unfortunate experiment like yours without even rolling a regular backup.
Before I do such dubious recursive substitutions I just would create a snapshot volume of the affected LV like
Above I only created a snapshot of 88 MB of the 5 GB /usr volume because I hadn't any more free PEs in my vgfc.
Normally, one would adapt this to the size of the snapped of LV and the anticipated amount of changes during the period one would possibly require the snapshot.
As a rule of thumb 10% suffice, but this depends on the changes in the filesystem.
Since /usr is pretty static (and even could be mounted ro often) there won't be many changes.
From the lvs command above you can watch the filling up of the snapshot with the changes.
Once the snap_percent approaches 100% your snapshot is useless and can't be any longer used for recoveries.
Now you can safely run your command.
If something goes wrong, you simply mount the snapshot volume ro somewhere and run your restore.
Once you no longer need your snapshot simply lvremove it.
Last edited by buffoonix; 09-02-2008 at 06:03 AM..
As a minor correction to what bakunin wrote, actually ^M doesn't stand for carriage return, it means the character M at beginning of line (i.e. beginning of file or immediately after a line feed).
You are right, of course. The reason for this is the only way i ever had to use "^M" was to remove DOS-style CR/LFs from text documents, like
sed 's/^M$//' document
therefore seeing the "^M" evocated this Pavlovian reflex in me - "use of ^M must mean remove CR/LFs" and i didn't even read any further. Of course "^M" means, in the normal sense of a non-escaped character, an M at the beginning of a line like you pointed out correctly.
Sigh, this comes from working in DOS/Windows-contaminated environments for too long. I probably got infected.
Hi Team,
I have deleted a file accidentally by using rm command. I am not the root(admin) user. Can you please let me know how to get that .tex file? (2 Replies)
Hi Guys,
I am using SunOS 5.9 running Oracle Databases on it...
I have log files that I suspect that some lines within the logs where removed.
How do I tell if indeed some lines within a particular file where removed and by whom?
Thanks in advance (2 Replies)
Hi,
I have a text file with 2000 rows and 2000 columns (number of columns might vary from row to row) and "comma" is the delimiter.
In every row, there maybe few duplicates and we need to remove those duplicates and "shift left" the consequent values.
ex:
111 222 111 555
444 999 666... (6 Replies)
Hello all!
I ran rm -rf on a wrong directory, noticed it and hit ctrl-c.
Is there any way on a debian machine to tell what actually got deleted?
As there were many dirs and files in this directory that I don't care for, I'd like to see if anything important was removed.
Or do you know in... (4 Replies)
Hello,
I was reading the manual on rm and it states that when you use 'rm' the files are usual recoverable, how is this done?
Does it assume that a backup system is in place?
Cheers
Jack (4 Replies)
hello Everyone.
I'm having the following problem:
I have number of installation in the directory. each installation consists of executable file and directory. when I do the new installation I move old one to File_name-Time_stamp. this is done for executable and for directory. Everything is done... (6 Replies)
I have windows Xp installed, and decided to install Solaris Sun Unix 10. The hard disk was previousely partitioned into 5 partition. C: = Win98 D = WinXP and e,f,g,h are applications and so on. When istalling Sun Unix, will all the drives be removed, or I will specify where to install it. Thanks... (5 Replies)