linux shell 文件中有多少个字符

如题所述

Shell中求字符串中单词的个数的几种方法
方法一:
[linux@host ~]# echo 'one two three four five' | wc -w5
方法二:
[linux@host ~]# echo 'one two three four five' | awk '{print NF}'5

方法三:
[linux@host ~]# s='one two three four five'[linux@host ~]# set ${s}[linux@host ~]# echo $#5
方法四:
[linux@host ~]# s='one two three four five'[linux@host ~]# a=($s)[linux@host ~]# echo ${#a[@]}
方法五:
[linux@host ~]# s='one two three four five'[linux@host ~]# echo $s | tr ' ' '\n' | wc -l 命令详细介绍请查看“Linux命令大全”。
温馨提示:答案为网友推荐,仅供参考
第1个回答  2014-11-18
不知道你是不是想用linux shell统计一个文本文件中有多少个字符,如果是的话,用wc命令。
wc -m 文件名
这样可以统计出这个文件中共有多少个字符。本回答被提问者和网友采纳
第2个回答  2014-11-16
nan ascii追答

man ascii

第3个回答  2014-11-15
没看懂你是啥意思,shell文件跟普通文本没有区别。
第4个回答  2014-11-15
10
相似回答