From f12c0f9442f644f51ec6a67466524249ee3ec8de Mon Sep 17 00:00:00 2001 From: Jimmy Song Date: Tue, 21 Nov 2017 23:14:05 +0800 Subject: [PATCH] add Chinsese character count script --- tools/wordcount.sh | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100755 tools/wordcount.sh diff --git a/tools/wordcount.sh b/tools/wordcount.sh new file mode 100755 index 000000000..04e4ce484 --- /dev/null +++ b/tools/wordcount.sh @@ -0,0 +1,13 @@ +#!/bin/bash +# Count Chinese characters +total=0 +basedir="../" +for x in `cd $basedir;fd -e md` +do + i=`cnwordcount -f $basedir/$x|cut -d " " -f2` + total=$(($total+$i)) + if [ $i -ne 0 ]; then + echo "$x $i" + fi +done +echo "Total $total"