Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/shell/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Linux 在shell中打印非ascii/unicode字符_Linux_Shell_Unicode_Non Ascii Characters - Fatal编程技术网

Linux 在shell中打印非ascii/unicode字符

Linux 在shell中打印非ascii/unicode字符,linux,shell,unicode,non-ascii-characters,Linux,Shell,Unicode,Non Ascii Characters,我正在使用以下命令搜索和打印非ascii字符: grep --color -R -C 2 -P -n "[\x80-\xFF]" . 我得到的输出,打印出一行,其中包含非ascii字符。 但是,它不会打印实际的unicode字符 有没有打印unicode字符的方法 输出 这一点得到了答复。如中所示,真正的问题是您使用的正则表达式用于单个字节,而UTF-8是多字节编码(因此模式必须覆盖多个字节) 后一个Q/A中的扩展by@似乎是最好的,使用的是Perl。grep是错误的工具 ./test.yml

我正在使用以下命令搜索和打印非ascii字符:

grep --color -R -C 2 -P -n "[\x80-\xFF]" .
我得到的输出,打印出一行,其中包含非ascii字符。 但是,它不会打印实际的unicode字符

有没有打印unicode字符的方法

输出 这一点得到了答复。如中所示,真正的问题是您使用的正则表达式用于单个字节,而UTF-8是多字节编码(因此模式必须覆盖多个字节)

后一个Q/A中的扩展by@似乎是最好的,使用的是Perl。grep是错误的工具

./test.yml-35-
./test.yml-36-- name: Flush Handlers
./test.yml:37:  meta: flush_handlers
./test.yml-38-
--