Here you go:
$('#btnRearrange').bind("click", function() {
$("#test td").each(function () {
var tdText = $(this).text();
$("#test td")
.filter(function () {
return tdText == $(this).text();
})
.not(":first")
.remove();
});
});
Try it out here:
http://jsfiddle.net/MAnLM/3/