Zählen Sie das Ereignis von Wort in Unix Bash
$ grep -o -i needs inspire.txt | wc -l
MisterAwesome23
$ grep -o -i needs inspire.txt | wc -l
let count=0
for x in ${my_array[*]}; do
if [ $x == 'abc' ]
then
count=$((count+1))
fi
done
countz() {
echo "$1" | tr -cd "$2" | wc -c
}
declare -l myString="1-2-3-4-5-6-7-8-9-0" myChar="-"
echo $(countz "$myString" "$myChar") #outputs: 9