开发者

removing multibyte characters from a file using sed

开发者 https://www.devze.com 2023-01-12 11:21 出处:网络
i need to remove all multibyte characters from a file, i dont know what they are so i need to cover the whole ra开发者_如何学运维nge.

i need to remove all multibyte characters from a file, i dont know what they are so i need to cover the whole ra开发者_如何学运维nge.

I can find them using grep like so: grep -P "[\x80-\xFF]" 'myfile'

Trying to do a simular thing with sed, but delete them instead.

Cheers


Give this a try:

LANG=C sed 's/[\x80-\xFF]//g' filename


you can use iconv to convert from one encoding to another

0

精彩评论

暂无评论...
验证码 换一张
取 消