Valami ilyesmi? $ cat a.txt aab aaa ba $ cat a.txt | while read line; do echo $line | grep -o a | wc -l; done; 2 3 0 1