Replace control m


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Replace control m
# 1  
Old 09-29-2008
Replace control m

Hi

I want to find ^M characters in all files in dir and subdirectory and replace .



In single file use this and change ,how can i cahnge in files under subdirectory.

perl -i -pe 's/^MZ//g' *.txt

sed -e 's/^M//g' filename >filename.new

Thanks in advance
MR
# 2  
Old 09-29-2008
use find and -exec
# 3  
Old 09-29-2008
The best way is to use "dos2unix" command to convert files has ^M character to standard unix format.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

awk script to extract a column, replace one of the header and replace year(from ddmmyy to yyyy)

I have a csv which has lot of columns . I was looking for an awk script which would extract a column twice. for the first occurance the header and data needs to be intact but for the second occurance i want to replace the header name since it a duplicate and extract year value which is in ddmmyy... (10 Replies)
Discussion started by: Kunalcurious
10 Replies

2. Shell Programming and Scripting

Replace Control M (^M) character with new line

Hi All, We are getting an external file in abc.csv format. When opened in excel spread sheet, it is opening alright. But when opened in notepad, I see the contents in a single line. Ftp'd the file in binary mode to AIX UNIX host. When opened, I see Control M (^M) characters in place of New Line... (16 Replies)
Discussion started by: njny
16 Replies

3. Shell Programming and Scripting

awk - replace number of string length from search and replace for a serialized array

Hello, I really would appreciate some help with a bash script for some string manipulation on an SQL dump: I'd like to be able to rename "sites/WHATEVER/files" to "sites/SOMETHINGELSE/files" within the sql dump. This is quite easy with sed: sed -e... (1 Reply)
Discussion started by: otrotipo
1 Replies

4. Shell Programming and Scripting

Replace any control character in the string

Need to replace any control character in the string in perl ---------- Post updated at 04:22 PM ---------- Previous update was at 03:50 PM ---------- Any help !!! Thanks in advance (2 Replies)
Discussion started by: hansini
2 Replies

5. UNIX for Dummies Questions & Answers

vi Search for text, Replace with <CR> or control character.

Greetings, Using vi, how can I change the following text: -I/myviews/nexus_7400rel/vobs/nexus/platforms/97400/include -I/myviews/nexus_7400rel/vobs/nexus/modules/i2c/7400/include -I/myviews/nexus_7400rel/vobs/nexus/modules/surface/7400/include Into this:... (4 Replies)
Discussion started by: omega949
4 Replies

6. Programming

Revision Control Sw

Hi All, Please let me know any freeware revision control software name and URL. Any response is highly appreciated. OS: Solaris 5.10 Thanks, Naga:cool: (3 Replies)
Discussion started by: Nagapandi
3 Replies

7. Shell Programming and Scripting

How To replace Control-M in all files in a folder

hi all, I copied set of files from a linux machine to an aix machine but in binary mode copy , ASCII mode copy both leed to control M charecters in most of the files. Any shell script/C script to remove control M charecters in all files in a given directory. Pls reply if you are aware... (10 Replies)
Discussion started by: padpa
10 Replies

8. UNIX for Advanced & Expert Users

New to Control-M

Hi, I am very new to Control-M . If anywone know about the global conditions in Control-M. (5 Replies)
Discussion started by: oraclenerd
5 Replies

9. Shell Programming and Scripting

how to replace control characters using sed?

How can I use sed to replace a ctrl character such as 'new line' (\0a) to something else? Or any other good command can do this job? Thanks, Hillxy (5 Replies)
Discussion started by: hillxy
5 Replies
Login or Register to Ask a Question