procmail
[Top] [All Lists]

A tip (was: Reversing text?)

2002-05-14 03:32:15

        I note from the FAQ and from this list that we try to avoid echos
        or double pipes for performance reasons.    Maybe it will helps,
        by using awk(1) you can pass input as argument and work around IO
        handling.  The following example reverse the text in MATCH with
        no need for echo or IO redirect:

awk 'BEGIN{NF=split(O,T,".");for(i=NF;i;i--)N=N"/"T[i];print N;exit}' O=$MATCH

        1>  awk runs the BEGIN part before open the input file! note the exit
            command to avoid IO business after BEGIN finished.

        2>  Did you see that the argumens are _FOLLOWING_ the action part?
            awk  '...'  O=$MATCH


Enjoy
 Udi

_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

<Prev in Thread] Current Thread [Next in Thread>