@hyperrealgopher
This is probably wrong I found a way to count characters in a string on stackoverrflow then adapted it for this
#https://gist.github.com/hyperrealgopher/19730725804ba8825d50d96f75b88a96
string="aaaabbbccd"
char="a"
echo "character count for a"
awk -F"${char}" '{print NF-1}' <<< "${string}"
char="b"
echo "charcter count for b"
awk -F"${char}" '{print NF-1}' <<< "${string}"
char="c"
echo "character count for c"
awk -F"${char}" '{print NF-1}' <<< "${string}"
char="d"
echo "character count for d"
awk -F"${char}" '{print NF-1}' <<< "${string}"
Good point and you want me to separate the count for the first set of a's and the last one not give a total.
@zleap Close, but no cigar! Very interesting solution, but if you look at the output closer, you'll notice that 'a' at the end!