Use awk to split the path on :, then loop over each field and store it in an array. If you come across a field which is already in the array, that means you have seen it before, so don't print it.
Here is an example:
$ MYPATH=.:/foo/bar/bin:/usr/bin:/foo/bar/bin $ awk -F: '{for(i=1;i<=NF;i++) if(!($i in arr)){arr[$i];printf s$i;s=":"}}' <<< "$MYPATH" .:/foo/bar/bin:/usr/bin (Updated to remove the trailing semicolon:.)