我已经为char,word,行计数编写了这段代码,但我没有得到预期的结果。有人可以帮忙吗?
var result= scontext.textFile("hdfs://localhost:9000/home/usr/abc/fileName.txt", 2)
答案 0 :(得分:1)
使用此脚本
echo Enter filename
read file
w=`cat $file | wc -w`
c=`cat $file | wc -c`
l=`grep -c "." $file`
echo Number of characters in $file is $c
echo Number of words in $file is $w
echo Number of lines in $file is $l