This can be a way:
$ cat a
hello hello bye but bye yeah
hello yeah
$ awk 'BEGIN{OFS=FS=" "}
{ for (i=1; i<=NF; i++) {
if (!($i in a)) {printf "%s%s",$i,OFS; a[$i]=$i}
};
delete a;
print ""
}' a
hello bye but yeah
hello yeah
You can change the field separator:
$ cat a
hello|hello|bye|but|bye|yeah
hello|yeah
$ awk 'BEGIN{OFS=FS="|"} {for (i=1; i<=NF; i++) {if (!($i in a)) {printf "%s%s",$i,OFS; a[$i]=$i}}; delete a; print ""}' a
hello|bye|but|yeah|
hello|yeah|