We have a text file source.txt with unknown number of lines. In bourne shell, how to split it into several files with 300 lines each and named the files in the format source##.txt?
Thanks! However, if use split, is it possible to make the output file in the format source01.txt, source02.txt...etc instead of sourceaa.txt, sourceab.txt...?
I tried the csplit but if I run "csplit -f source srouce.txt 300", the first file created source01 only contains 299 lines instead of 300 lines.
From the manual :
For example, if the original file had 108 lines and you entered:
csplit orginal.txt 11 72 98
the csplit command would create four files: the xx00 file would contain lines 1-10, the xx01 file would contain lines 11-71, the xx02 file would contain lines 72-97, the xx03 file would contain lines 98-108.
So - do csplit -f source source.txt 301
Dickie Bird (-)))
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.