Re: Those wretched ^M's!

From: Edward Glamkowski (EGlamkowski@MATHEMATICA-MPR.COM)
Date: 11/13/97


>> Using your patch or my extra checks, you'll still get ^M's in your files
>> on a unix system every time you save, tho they won't stack up.
>
>        Well, just remember....vi is your friend. :)
>
>        :g/ /s///g

Or, if you have it: dos2unix

or write a perl script (or a sed script, but I'll leave
that as an exercise for the reader :)
#!/usr/local/bin/perl -i.bak

while (<>) {
  if /($^M)/ { s/$1//g; }
  print;
}

(N.B. I'd embed that ^M using emacs - ctrl-q ctrl-m,
NOT just a carat followed by a capital M...)
this has the added convience of being highly reusable,
can create backups of the original files (kill the .bak
in the -i switch if you don't want backups) and accepts
more than one file for input:
crlf.pl *.c *.h

That'd be a tedious process to do that for every single
file using vi ;)


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/08/00 PST