Hello.
Funny thing about sed, is that is plain old regexp, with no backtracking like PCRE regexp’s do, on the contrary. I read a paper recently, stating that the regexp engine in sed, awk, and familiar old tools. can be a over a million times faster than the one in languages like php, java, ruby,perl and so on, (given the right regexep of course).
What was said made a lot of sense, given the primitiveness of the algorithms, contrary to the newer PCRE, the paper stated that they outperformed anything else, in any other language within their problem solving domain.
So, basically, if you need fast regexp’s you’d settle for sed, and at least not perl or any other scripted language, unless you need the features that PCRE gives, like lookahead, behind, and so on.
I’m not discussing this, just for your information. And, I found the link
(Thompson NFA, would be the name of the algorithm that are used in sed, awk and grep.)
In all fairness, you have like 5 different problem domains, ending with natural grammar, sed, awk and grep is capapable of solving problems within the first one , which if memory serves me right is regular grammars, PCRE is capable of sovling problems in context free grammars, but from there on after, it is a NP problem.
You can read about it here
The conclusion must be that sed, awk and similies are best in their little problem domain. From there onwards, it is better to use tools like cocoa, php, perl, java, and so on that implements PCRE.
Having said all this. Let me finish with, that I am very happy that I am scripting in Applescript, where I have an abudance of options, for getting a good solution! And I see no general “right” solution really, I am not religous, I think most solutions are right given a fitting context.