Remove duplicate characters and keep the uniq ones

Posted by manu on Stack Overflow See other posts from Stack Overflow or by manu
Published on 2010-04-06T06:00:54Z Indexed on 2010/04/06 6:03 UTC
Read the original article Hit count: 166

Filed under:

How do I remove duplicate characters and keep the uniq one only. Ex. My input is

EFUAHUU

UUUEUUUUH

UJUJHHACDEFUCU

Expected output is

EFUAH

UEH

UJHACDEF

I cam across perl -pe's/$1//gwhile/(.).*\/' which is wonderful but it is removing even the single occurence of the character in output.

Can anyone help. Thanks in advance

Manjeet

© Stack Overflow or respective owner

Related posts about perl