#Save all your fasta in seq.fa and run the following ... perl -ne 'print if /^>/' seq.fa #Print header with line number perl -ne 'print "$. $_" if /^>/ ' seq.fa