procmail
[Top] [All Lists]

Re: how to drop last N characters from string?

1997-12-04 10:57:02
Jari Aalto asked,

|     It's relatively easy to get match by delimiting the start to the
|     left, but how do you chop off N chracters from the right?
| 
|         VAR = "1234567890"
| 
|         :0
|         * VAR 123\/.*

That should be
          * VAR ?? 123\/.*

|         {
|             rest = $MATCH
| 
|             Now I want to cop off "90" from $rest ?
|         }


       * VAR ?? ()\/..$

Because the $ is matched to a putatitve newline rather than a real one,
it will not appear in the resulting value of $MATCH.

|     Also what's the procmail way to increment variable by N ?

     :0
     * $ $VAR^0
     * $ $N^0
     { VAR = $= }