imho, there's no need for a while loop deleting the N last tokens, you might use gettok instead: $gettok(tokens,N1-,C)
after setting %hash and %item, try something like:
Code:
echo -a old data for item %item of table %hash : $hget(%hash,%item)
hadd %hash %item $gettok($hget(%hash,%item),$+($int($calc($numtok($hget(%hash,%item),32) /2 +1)),-),32)
echo -a new data of item %item of table %hash : $hget(%hash,%item)

$deltok also supports N1-[N2], and you may use negative numbers to delete the last tokens, e.g.:
$deltok(a b c d e f g,-1--3,32)
or
$deltok(a b c d e f g,-3-,32)

Last edited by Horstl; 09/06/08 11:04 PM.