Find Unique Characters in a File

前端 未结 22 2321
耶瑟儿~
耶瑟儿~ 2021-02-04 03:30

I have a file with 450,000+ rows of entries. Each entry is about 7 characters in length. What I want to know is the unique characters of this file.

For instance, if my f

22条回答
  •  时光说笑
    2021-02-04 04:09

    As requested, a pure shell-script "solution":

    sed -e "s/./\0\n/g" inputfile | sort -u
    

    It's not nice, it's not fast and the output is not exactly as specified, but it should work ... mostly.

    For even more ridiculousness, I present the version that dumps the output on one line:

    sed -e "s/./\0\n/g" inputfile | sort -u | while read c; do echo -n "$c" ; done
    

提交回复
热议问题