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
removing pattern which is spread in multiple lines sabyasm Shell Programming and Scripting 2 05-13-2008 06:19 AM
Removing certain text from multiple filenames Djaunl UNIX for Dummies Questions & Answers 6 01-15-2008 05:52 PM
removing old files except configuration files and folders jamcalicut Shell Programming and Scripting 1 11-09-2007 04:34 PM
Please Help. Need Help searching for multiple stings in a file and removing them. mjs3221 UNIX for Advanced & Expert Users 2 08-19-2006 07:28 AM
Removing user from multiple groups via command line jquizon62 SUN Solaris 1 10-28-2004 01:56 PM

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 11-15-2007
deaconf19 deaconf19 is offline
Registered User
  
 

Join Date: Sep 2007
Location: EX-PAT in Taipei, Taiwan
Posts: 152
Removing M^ from multiple files

to do this i usually type dos2unix <file> -o <file>
and this will remove the M^ from the end of each file. well i have over 100 files that someone copied that i need. how do i remove the M^. i saw a perl script but i am not familiar with .pl at all really
  #2 (permalink)  
Old 11-16-2007
porter porter is offline Forum Advisor  
Registered User
  
 

Join Date: Jan 2007
Posts: 2,965
Perl not needed.

Try it in a test area first.....

Code:
#!/bin/sh

find directory -type f | while read N
do
          if dos2unix "$N" -o "$N".tmp
          then
                 mv "$N".tmp "$N"
          fi
done
  #3 (permalink)  
Old 11-16-2007
deaconf19 deaconf19 is offline
Registered User
  
 

Join Date: Sep 2007
Location: EX-PAT in Taipei, Taiwan
Posts: 152
sorry i just reread my post. i meant within the file there is the ^M not on the extensions.
  #4 (permalink)  
Old 11-16-2007
deaconf19 deaconf19 is offline
Registered User
  
 

Join Date: Sep 2007
Location: EX-PAT in Taipei, Taiwan
Posts: 152
sorry but it cannot find when i run the command

find: cannot open directory: No such file or directory
  #5 (permalink)  
Old 11-16-2007
porter porter is offline Forum Advisor  
Registered User
  
 

Join Date: Jan 2007
Posts: 2,965
Quote:
Originally Posted by deaconf19 View Post
sorry but it cannot find when i run the command

find: cannot open directory: No such file or directory

That is because "directory" is supposed to be replaced by the directory you want to make the changes in.

As a general idea, if you are offered a script that you don't understand what it's doing, don't run it, ask what a part of it is doing. Otherwise people could tell you to run all kinds of rubbish.
  #6 (permalink)  
Old 11-20-2007
edcrosbys edcrosbys is offline
Read Only
  
 

Join Date: Jul 2007
Posts: 15
Just to pass on snippets, here's what I use:

perl -pe 's/\015\012/\n/g' - dos to unix -- just pipe through it
perl -pe 's/\n/\015\012/g' - unix to dos -- just pipe through it

cat filename |perl -pe 's/\015\012/\n/g' > filename.without.ctrl.m

dos2unix works well, but isn't on all systems. I now use this perl.
  #7 (permalink)  
Old 11-20-2007
swat swat is offline
Registered User
  
 

Join Date: Feb 2007
Posts: 24
Hi all My requirement is to remove ^L Character by Newline and 1

x^L is the input and output shoud be
x
1
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 08:26 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