The following sed snippet will remove the duplicate letters in the string and print only the unique letters :
> echo "remove duplicate letters from string" | sed ':;s/\(.\)\(.*\)\1/\1\2/;t'
> remov duplicatsfng
What would be the regular expression to ONLY print the duplicate letters - thus unique letters are discarded ( eg: v and d ) and the letters appearing more than once should not be repeated in the output !
The result should be :
> remo lits