echo "asdefedgwe" | grep -o 'e' | wc -lecho "asdefedasdfasdfagwe" | tr -dc 'e' | wc -mecho "asdefedgwe" | awk '{s+=gsub(/e/,"&")}END{print s}' echo "asdefedasdfasdfagwe" | awk -v RS="e" 'END{print NR-1}'echo "asdefedasdfasdfagwe" | sed -n 's/./&\n/gp' | sed -n '/e/p' | wc -l echo "asdefedasdfasdfagwe" | awk -F'e' '{print NF-1}'