E.g.
Given a file input.txt
, which has the following content:
He likes cats, really?
the output would be like:
H
e
l
i
k
s
c
a
t
,
r
l
y
?
Note the order of characters in output does not matter.
How about:
echo "He likes cats, really?" | fold -w1 | sort -u
One way using grep -o .
to put each character on a newline and sort -u
to remove duplicates:
$ grep -o . file | sort -u
Or a solution that doesn't required sort -u
or multiple commands written purely in awk
:
$ awk '{for(i=1;i<=NF;i++)if(!a[$i]++)print $i}' FS="" file
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With