Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
例如,给定“可见字符”类
[:graph:]
又名
[\x21-\x7E]
我怎么能以“整理”顺序打印那些,这是由LC_COLLATE
LC_COLLATE
只需通过排序运行它。最难的部分是获取字符列表。这适用于 ASCII:
for ((i=0x21; i<=0x7E; i++)) do printf "\\$(printf '%03o' $i)\0"; done | sort -z | tr -d '\0'
它写出每个字符后跟一个 NUL 字节,然后将它们全部排序(sort考虑 LC_COLLATE),最后删除 NUL。
sort