count specific word in line in bash Answer #1 100 %This will do what you want: echo "1,2,3" | tr -cd ',' | wc -c Tags: bash