perl -i'*' -anle"@f=; shift @F; push @F, scalar @f; print join ' ', @F;" counts #### echo 0 0 0 0 0 0 0 0 > counts