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}
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!