Counting a specific consecutive character with its occurrence position and length
I couldn't come up with a one liner but have a two liner instead...

To get the start positions of the N repeat:

grep N mySeq.fasta | grep -b -o N | awk -F: '{print $1}' |awk '$1!=p+1{print $1}{p=$1}'
12
38
56


To get the length of the repeats:

grep N mySeq.fasta | awk -F '[^N]+' '{for (i=1; i&lt;=NF; i++) if ($i != "") print length($i)}' 
14
6
9


With thanks to stack overflow.