$ perl -le 'my $s = "ABCDEF"; print substr $s, $_, 3 for 0..length($s)-3;' ABC BCD CDE DEF