免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 3063 | 回复: 3
打印 上一主题 下一主题

[系统安装] bash中wc的指令 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2012-06-02 05:53 |只看该作者 |倒序浏览
不知道有没有人研究过bash中wc的指令
其中
wc中的manual是这样写的
    -c,--bytes
          print the byte counts
    -m--chars
          print the character counts
我在终端输入
cat /etc/manpath.config|wc -c 和
cat /etc/manpath.config|wc -m
着两个结果一模一样
求解释,谢谢啦

论坛徽章:
13
15-16赛季CBA联赛之同曦
日期:2016-01-28 19:52:032015亚冠之北京国安
日期:2015-10-07 14:28:19NBA常规赛纪念章
日期:2015-05-04 22:32:03处女座
日期:2015-01-15 19:45:44卯兔
日期:2014-10-28 16:17:14白羊座
日期:2014-05-24 15:10:46寅虎
日期:2014-05-10 09:50:35白羊座
日期:2014-03-12 20:52:17午马
日期:2014-03-01 08:37:27射手座
日期:2014-02-19 19:26:54子鼠
日期:2013-11-30 09:03:56狮子座
日期:2013-09-08 08:37:52
2 [报告]
发表于 2012-06-02 08:14 |只看该作者
-m      The number of characters in each input file is written to the
             standard output.  If the current locale does not support multi‐
             byte characters, this is equivalent to the -c option.  This will
             cancel out any prior usage of the -c option.

-c      The number of bytes in each input file is written to the standard
             output.  This will cancel out any prior usage of the -m option.

论坛徽章:
0
3 [报告]
发表于 2012-06-02 08:19 |只看该作者
-c :   统计文件中的字节数
-m:    统计文件内容中的字符数,若文件内容都是单字节字符,则等同于-c选项

论坛徽章:
0
4 [报告]
发表于 2012-06-02 08:35 |只看该作者
cecil911 发表于 2012-06-02 05:53
不知道有没有人研究过bash中wc的指令
其中
wc中的manual是这样写的

为什么会出现这种情况,原因:参考资料
所以A-Z a-z 0-9大多数字符都是 (1 byte in size),因此-c和-m参数使用的结果会一样!lz不妨测试下,建立一个新文件(其中输入中文字符),结果会怎么样?
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP