People really overcomplicate this - a particularly regular expression:
ls | grep -o "\..*" | uniq
ls- get all files
grep -o "\..*"- -oshows only a match; "\..*"matches the first "." and everything after it
uniq- do not print duplicates, but keep the same order
you can also sort if you want, but sorting doesn't match the example
Here's what happens at startup:
> ls -1
a.t
a.t.pg
c.bin
d.bin
e.old
f.txt
g.txt
> ls | grep -o "\..*" | uniq
.t
.t.pg
.bin
.old
.txt
source
share