The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
How To replace Control-M in all files in a folder padpa Shell Programming and Scripting 10 09-02-2008 06:58 AM
Whi I'm getting control-M's padpa UNIX for Dummies Questions & Answers 14 12-13-2007 07:18 AM
Fan control Timmy66 BSD 1 08-02-2007 09:59 AM
New to Control-M oraclenerd UNIX for Advanced & Expert Users 5 05-18-2006 10:21 AM
how to replace control characters using sed? hillxy Shell Programming and Scripting 5 10-16-2003 10:12 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 09-29-2008
mohan705 mohan705 is offline
Registered User
  
 

Join Date: Feb 2007
Posts: 134
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 (permalink)  
Old 09-29-2008
ghostdog74 ghostdog74 is offline Forum Advisor  
Registered User
  
 

Join Date: Sep 2006
Posts: 2,518
use find and -exec
  #3 (permalink)  
Old 09-29-2008
fongthai fongthai is offline
Registered User
  
 

Join Date: Nov 2006
Posts: 54
The best way is to use "dos2unix" command to convert files has ^M character to standard unix format.
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 09:38 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0