perl -nle 'chomp;tr/a-z/A-Z/;next if /[^ATCG]/;$l=length();$c=0;for $m(5..$l){print substr($_,$c++,5)}' uniBNL_SSR_fasta.txt.input_library.txt | perl -nle '$c{$_}++ for split/\W/;}print map {"$_:$c{$_}\n"} sort{$c{$b}<=>$c{$a}}keys %c;{' - #### ... AGAGA:5334 GAGAG:5124 TCTCT:1938 AAAAA:1908 ACACA:1884 TTTTT:1851 CTCTC:1798 ... #### #!/usr/bin/perl # # simple fasta input file cleaver # usage: cleaver.pl --format OUTPUT_FILE_PREFIX --number X input_file # where X is the number of files to split input_file into # # note: you can optionally pass more than one input file # to (re)combine into X files use strict; use warnings; use Getopt::Long; my ($number,$format)=(2,"output"); GetOptions( "number=i" => \$number, "format=s" => \$format, ); my @output_file; foreach my $num(1..$number) { my $file ="$format.$num"; open($output_file[$num-1],">",$file) or die; } my $file_num = 0; while(<>) { $/='>'; chomp; my $pre = ($. != 2 ? ">" : ""); print {$output_file[$file_num]} "$pre$_"; next if $. == 1; $file_num +=1; $file_num %= $number; }