[wplug] Converting Line Terminations

Emilio Xavier Esposito exesposito at kent.net
Thu Feb 7 11:10:45 EST 2002


If you are referring to the ^M at the end of Windows files in *nix try this
c-code:

#include <stdio.h>

main()
{
  char s[200];
  int i;
  while( gets(s) != NULL ){
    for(i=0;i<strlen(s);i++){
      if( strcmp(&s[i],"\r") != 0)
 putchar(s[i]);
    }
    putchar('\n');
  }
}


It should remove the carriage returns and make things better.
Emilio


----- Original Message -----
From: J Aaron Farr <jaaron_farr at hotmail.com>
To: <wplug at wplug.org>
Sent: Thursday, February 07, 2002 11:01 AM
Subject: [wplug] Converting Line Terminations


Hello,

I end up having to work with a lot of text files on both *nix and WinNT.
The end of line terminations is differnt between the two of them.  Is there
a simple command I can use from a bash prompt that will convert between the
two?  (It's not a big deal, more just a slight annoyance.)

James already gave me one suggestion, but I can't seem to remember what is
was -- sorry James.

Thanks,
jaaron




_________________________________________________________________
Join the world's largest e-mail service with MSN Hotmail.
http://www.hotmail.com

_______________________________________________
wplug mailing list
wplug at wplug.org
http://www.wplug.org/mailman/listinfo/wplug





More information about the wplug mailing list