It's not at all clear what concept you are looking for. Perhaps you could elaborate on that a bit. In the meantime, here are some hopefully useful exercises.
Code:
var2=$var1 #copy var1 to var2
var2=${var2%abcd} # trim abcd from end, if present
var2=`echo "$var2" | tr ' ' '\012' | sort | uniq | tr '\012' ' '` # remove duplicate tokens
The token duplicate removal is probably quite different from what you are imagining it would be, and has the unfortunate side effect of sorting the remaining tokens. In this case it doesn't matter, because they were already sorted, but nevertheless it's not a good general-purpose solution if the order of tokens is significant.
Perhaps you should read a tutorial on shell programming at this point; there's a lot of things you can do with variable substitution (${var%trim} is but a single example).