LINUX.IE, website of the Irish Linux Users' Group
Tux rules!

   
Home
New Users
Articles
Download
Projects
Community
Vendors

  Print Version
Email to...
 
Archives:


planetILUG

Recent News

News Archive


Join the
ILUG
on FaceBook


Join the
ILUG
on LinkedIn


Join the
ILUG SETI
Group



















 
 :: Mailing Lists

[ILUG] ^M quickie

[ILUG] ^M quickie

Fergal Daly fergal at esatclear.ie
Fri May 5 00:12:16 IST 2000


or add these aliases to your shell rcfile (may need to change the quoting, 
these are for tcsh)

alias undos "perl -pi -e 's/\r//g'"
alias redos "perl -pi -e 's/\n/\r\n/g'"

to remove or add ^Ms

alias undosall "perl -pi -e 's/\r//g' \`find -type f\`"
alias redosall "perl -pi -e 's/\n/\r\n/g' \`find -type f\`"

to do it recursively to all files

At 14:50 04/05/00, you wrote:
>I wrote:
> > Does anyone know of a quick way to get rid of ^M
>from
> > multiple files of the same format?
>
>Here's how to do it in Perl (almost entirely robbed
>from Perl Cookbook). I forgot that ^M is equivalent to
>\r for perl regex.
>
>#!/usr/local/bin/perl
>
>local $^I = '.old';
>local @ARGV = glob("*.c");
>while (<>) {
>s/\r//;
>print;
>} continue {close ARGV if eof}






More information about the ILUG mailing list
Read this without the formatting.
                                                                                                    

 

Hosted by HEAnet


Maintained by the ILUG website team. The aim of Linux.ie is to support and help commercial and private users of Linux in Ireland. You can display ILUG news in your own webpages, read backend information to find out how. Networking services kindly provided by HEAnet, server kindly donated by Dell. Linux is a trademark of Linus Torvalds, used with permission. No penguins were harmed in the production or maintenance of this highly praised website. Looking for the Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!
RSS Version
Powered by Dell