remove an element from array

I need to remove an element from the below array variable TABLENAME.

#!/bin/ksh
set -A TABLENAME "mirf roxar keke mirs"
echo "the array is ${TABLENAME[*]}"

If i need to remove say keke and have the final TABLENAME as below, how this could be achieved. Pls throw some light.

echo "Modified array is ${TABLENAME[*]}
mirf roxar mirs

The way you declare the array, you only have 1 element in it - you have to leave the double quotation marks away.

There is no functions available to delete elements directly from an array in ksh. You can either set it in a case of a match while looping (I did it without using it's index but treating it as a list) through the elements to "nothing" but you will have a gap in the array then. If you want to remove it and have the array elements filling up the gap, you can try something like this:

> set -A TABLENAME mirf roxar keke mirs
> echo ${TABLENAME[2]}
keke
> TMP=$(for A in ${TABLENAME[*]}; do echo $A| grep -v keke; done)
> echo $TMP     ## at this stage, TMP is no array since it's elements have no index, so we will make an array of it again with set -A 2 lines below:
mirf roxar mirs
> set -A TABLENAME $(echo $TMP)
> echo ${TABLENAME[2]}
mirs

Thank you. But wot if the element that need to be removed is random or that the index of the element to be removed is unknown.

If it is a random number from the index, you can identify it.
If the index is unknown, what do you know then - the string?

I think both can be handled with the example.