There is a standard command for file splitting - split.For example, if I want to split a words file in several chunks of 10000 lines, I can use:split -dl 10000 words wrdand it would generate several files of the form wrd.01, wrd.02 and so on.But I want to have a specific extension for those files - for example, I want to get wtd.01.txt, wrd.02.txt files.Is there a way to do it?
Split a file by line and have control over resulting files extension
shell;filenames;split
Not with split, but you can easily rename them afterwards, or you can do it in awk:awk '{filename = wrd. int((NR-1)/10000) .txt; print >> filename}' inputfile