Removed ^M from Libraries


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users Removed ^M from Libraries
# 8  
Old 09-02-2008
Quote:
Originally Posted by telecomics
I used the following to remove ^M in all files - I guess i did it in haste Smilie

find / -name "*" | xargs perl -p -i -e 's/^M//g' *
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 !!)

Code:
perl -p -i -e 's/\015(\012)/ $1/gs' *

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.
# 9  
Old 09-02-2008
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
# 10  
Old 09-02-2008
Thanks for all your replies .

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..
# 11  
Old 09-03-2008
Restore as much as you can and start over, would be my advice.
Login or Register to Ask a Question

Previous Thread | Next Thread

7 More Discussions You Might Find Interesting

1. Linux

file removed

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)
Discussion started by: darling
2 Replies

2. Shell Programming and Scripting

Removed Lines

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)
Discussion started by: Phuti
2 Replies

3. Shell Programming and Scripting

Duplicates to be removed

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)
Discussion started by: prvnrk
6 Replies

4. UNIX for Dummies Questions & Answers

a way to tell what was removed after rm -rf ?

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)
Discussion started by: thosch
4 Replies

5. UNIX for Dummies Questions & Answers

recovering files removed with rm

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)
Discussion started by: jack1981
4 Replies

6. Shell Programming and Scripting

directories are not getting removed

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)
Discussion started by: slavam
6 Replies

7. UNIX for Dummies Questions & Answers

Will Old Files Be Removed

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)
Discussion started by: sunsation
5 Replies
Login or Register to Ask a Question