Tomek Sowiński wrote:

> Dnia 03-11-2010 o 21:27:00 bearophile <bearophileh...@lycos.com>
> napisał(a):
> 
>> This is a comparison, how much good various languages are for scripting
>> purposes:
>> http://rigaux.org/language-study/scripting-language/
>> This test may be good both to see if there is something essential
>> missing in Phobos2 and to see how D2 is fit for those purposes (the list
>> contains some implementations in C, C#, etc too).
> 
> Nice page. I submitted some "scripts" so D will be featured on it.
> 
> BTW, I was stuck on "sed in place" -- remove #-comments from a file
> (modifying the file, i.e. in place):
> http://rigaux.org/language-study/scripting-language/#sed_in_place
> Any idea how to pull it off nicely?
> 

Here is a quick attempt:

import std.file, std.regex;

void main(string[] args)
{
    args[1].write( args[1].readText().replace( regex("#.*", "g"), "") );
}

Reply via email to