How will cut options -b and -c become different with Internationalization

元气小坏坏 提交于 2019-12-11 11:26:08

问题


`-b BYTE-LIST'
`--bytes=BYTE-LIST'
     Select for printing only the bytes in positions listed in
     BYTE-LIST.  Tabs and backspaces are treated like any other
     character; they take up 1 byte.  If an output delimiter is
     specified, (see the description of `--output-delimiter'), then
     output that string between ranges of selected bytes.

`-c CHARACTER-LIST'
`--characters=CHARACTER-LIST'
     Select for printing only the characters in positions listed in
     CHARACTER-LIST.  The same as `-b' for now, but
     internationalization will change that.  Tabs and backspaces are
     treated like any other character; they take up 1 character.  If an
     output delimiter is specified, (see the description of
     `--output-delimiter'), then output that string between ranges of
     selected bytes.

Description for -c says that : The same as `-b' for now, but internationalization will change that.

I am assuming Internationalized characters for some languages could have multi-byte characters and that is when -c and -b will behave differently..correct?


回答1:


Yes. Let's do a test:

$ cat a
200
bést
203
-Ümlaut
$ cut -b2-3 a
00
é           <---- é has 2 bytes
03
Ü           <---- Ü has 2 bytes
$ cut -c2-3 a
00
és
03
Üm


来源:https://stackoverflow.com/questions/25619162/how-will-cut-options-b-and-c-become-different-with-internationalization

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!