# Choose first N FASTA records perl -ne 'BEGIN {$/=">";$o=0}{chomp;$o$_"):last;$o++}' EXAMPLE.fa #### perl -ne 'BEGIN{$/=">";$o=0}{chomp;$o<22?(/^$/?next:print">$_"):last;$o++}' b4x_est100.fa # print the first 22 records