I wanted to split a large file into multiple files based on number of lines in linux. I read about split
and csplit
. These command provides an option to suffix the file with numeric value by making use of -d
option like split -d -l 100 largeFile.txt smallFile.txt.
would create the small files with smallFile.txt.00
,smallFile.txt.01 ....
. But I wanted starting index to be 01
instead of 00
. Man pages
does not give much information about that. So, Kindly help me on this and
Is there a better approach for splitting the file based on number of lines in linux?
Thank you
Since coreutils release 8.16 (2012-03-26) you can do:
split --numeric=1 -l 100 largeFile.txt smallFile.txt.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With