Help for this page
perl -ne "/foo(\d+)/ && do { open FILE, '>>', 'split'.$1.'.txt'; print + FILE $_; close FILE }" blah.txt