How to cut off options -b and -c to become different with internationalization

`-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.

The description for -csays that: Same as `-b ', but internationalization will change that.

I suppose that internationalized characters for some languages ​​can have multibyte characters, namely, when -cthey -bwill behave differently .. correctly?

+1
source share
1 answer

Yes. 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
+2
source

Source: https://habr.com/ru/post/1570167/


All Articles