Despite what bufoonix wrote, you can do what you are trying to do... To do it right, however, you must replace the \015 character with another character, such as a space (\020).
The thing is, you really don't want to replace all instances of \015, because that might represent code or some piece of instruction, initialization data, etc. You have to be more selective. Try something like this (and test it !!)
At least this way you get \015s coupled before a newline. The problem is trickier, however, since in some compilers, something like, "strchr(string, crnl)", the "crnl" is actually "\r\n" and the strchr library handles that as a special case. I'm not sure what will happen if you substitute a space-newline in there!
I can imagine other sorts of headaches you might encounter.
Location: Saint Paul, MN USA / BSD, CentOS, Debian, OS X, Solaris
Posts: 2,288
Thanks Given: 430
Thanked 480 Times in 395 Posts
Hi.
Quote:
Originally Posted by telecomics
...
find / -name "*" | xargs perl -p -i -e 's/^M//g' *
It changed all my LIBRABRIES since i used -- perl -p -i -e 's/^M//g' *
I suspect that because the OP began at /, there were also executables that were changed.
A filter to eliminate non-text items would be the first step I would suggest. The command file makes good guesses about the content of files, but it varies among systems, so one would need to do a few experiments first.
Running commands and scripts with an echo in front of the command that will do the real work is often a good idea. One then can see what will get changed, and the process can be fine-turned until it meets the requirements.
This was a good learning experience -- tough, but good -- and I think many of us have had that happen at least once. It underlines the usefulness of backups. Currently I do a lot of work in virtual machines, and the snapshot is very easy, not dissimilar to what buffoonix outlined for LVM volumes. I do that for almost every update that is made available. There was a number of weeks when GNU/Debian testing updates made a mess of fonts and the desktop. I did snapshots and restored until they got it straightened out ... cheers, drl
Just to mention, Ctrl V and then Ctrl M was used to replace the characters in the executed command which changed most of my jar and lib files.
My Sysadmin can backup the filesystem using /usr/openv/netbackup/bin/bp command
Is it better to replace just the libraries that were changed on that mountpoint (they are too many including the ./java/jre/lib ) or the entire mountpoint since my vignette application is "installed" on Solaris at /apps dir , would replacing the entire /appl directory be sensible ?
Another observation - No binary files were changed - signifying they dont have any such control chars.
Last edited by telecomics; 09-02-2008 at 04:11 PM..
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)