【问题标题】:How will cut options -b and -c become different with Internationalization削减选项 -b 和 -c 将如何随着国际化而变得不同
【发布时间】:2014-09-02 08:36:31
【问题描述】:
`-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.

-c 的描述是这样的:目前与 `-b' 相同,但国际化会改变这一点。

我假设某些语言的国际化字符可能具有多字节字符,那是 -c-b 的行为不同..正确吗?

【问题讨论】:

    标签: bash cut


    【解决方案1】:

    是的。让我们做一个测试:

    $ 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
    

    【讨论】:

    • 这对我来说很有意义。对我来说,在 Ubuntu 04.12 (UTF-8: "en_US.UTF-8") 上,'cut -c2-3 a' 和 'cut -b2-3 a' 产生相同的结果 - 'cut -b2-3 a'。
    • @Ronald 很有趣...我刚刚在 cygwin 8.15-1 中使用cut (GNU coreutils) 8.15 进行了尝试,它对于cut -b2-3 acut -c2-3 a 也显示相同。它绝对必须与语言环境和剪辑版本一起使用。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-12-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-11-13
    相关资源
    最近更新 更多