#! /bin/bash echo $1 | gawk ' { count=0; for(I=1;I<=15;I++) { target="-"I"-"; if (index($0, target)!=0) {count++;} } print count }'