Using a little script I wrote to rename files, I encounter a funny
behavior with '|'.  If the regular expressions share a part, doesn't
matter the order of those,  The first match from the start of the input
is processed.  Now that I'm writing this, it's seems obviously the
right behavior (and I think it is), for example:


        % echo '123' | sed s'/12|12/o/g' 
        o3
        % echo '123' | sed s'/23|12/o/g' 
        o3

But in large concatenations with strange characters like in:
        $ echo '__-' | sed s'/_-|_-_|-_|__+ ... and a lot of more cra* ... 
/__/g'
        
You could expect the output be '__', but it's '__-'

So... if you are a retard like me, don't try to be such smart and use
various sed commands.

trebol.


Reply via email to