Search by name or ID, mark the items you want to keep, and filter your selections.
The selected diamonds stay in the chest. The unwanted stacks have dropped, and the player inventory is unchanged.