Here is a Perl one-liner, taken from http://www.technocage.com/~caskey/dos2unix/
#!/usr/bin/perl -pi
s/\r\n/\n/;
You can run it as follows:
perl dos2unix.pl < file.dos > file.unix
Or, you can run it also in this way (the conversion is done in-place):
perl -pi dos2unix.pl file.dos
And here is my (naive) C version:
#include
int main(void)
{
int c;
while( (c = fgetc(stdin)) != EOF )
if(c != '\r')
fputc(c, stdout);
return 0;
}
You should run it with input and output redirection:
dos2unix.exe < file.dos > file.unix