perl -ne 'open FILE, ">>", "smallfile".int($./30).".txt"; print FILE $_; close FILE }' bigfile.txt