“非法字节序列"指的是“非法字节序列".在Mac bash终端中使用shell命令时出错 [英] "Illegal Byte sequence" error while using shell commands in mac bash terminal
本文介绍了“非法字节序列"指的是“非法字节序列".在Mac bash终端中使用shell命令时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在尝试从MacOS bash shell中的大文件中提取非英文字符时,出现非法字节序列"错误.这是我要使用的脚本:
Getting "illegal byte sequence" error while trying to extract non English characters from a large file in MacOS bash shell. This is the script that I am trying to use:
sed 's/[][a-z,0-9,A-Z,!@#\$%^&*(){}":/_-|. -][\;''=?]*//g' < $1 >Abhineet_extract1.txt;
sed 's/\(.\)/\1\
/g' <Abhineet_extract1.txt | sort | uniq |tr -d '\n' >&1;
rm Abhineet_extract1.txt;
这是我得到的错误:
uniq: stdin: Illegal byte sequence
'+?
推荐答案
似乎UTF-8语言环境导致非法字节序列
.
It seems that a UTF-8 locale is causing Illegal byte sequence
.
相反,说:
LC_CTYPE=C your_command
人工语言环境
说:
These environment variables affect each locale categories for all
locale-aware programs:
LC_CTYPE
Character classification and case conversion.
这篇关于“非法字节序列"指的是“非法字节序列".在Mac bash终端中使用shell命令时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文