Remove Duplicate Characters

Remove duplicate characters from a string while keeping only the first occurrence of each character.

Code

General
echo "$s" | awk '{while(match($0,/./)){c=substr($0,RSTART,1);if(!a[c]++)printf c;$0=substr($0,RSTART+1)}}'

Parameters

The string to remove duplicates from

Server

More Bash Snippets