nothing fancy here, we're just doing a regex replace on \r and replacing it with nothing. this is a different way of doing the same thing dennis already posted
here. =P
using System.IO;
using System.Text.RegularExpressions;
namespace StripCR
{
class Program
{
static void Main(string[] args)
{
nocr(args[0]);
}
public static void nocr(string f)
{
string t;
using (StreamReader r = new StreamReader(f))
t = Regex.Replace(r.ReadToEnd(), "\r", "");
using (StreamWriter w = new StreamWriter(f))
w.Write(t);
}
}
}and because i know you want to know, here's the ruby code too. =P
note: i haven't tested this, but it should at the very least put you in the right direction haha.
file = ARGV[0]
fc = IO.read(file).gsub(/\r/,"")
File.open(file,'w'){|f|
f.print(fc)
}