Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set starting index in split command in linux ?


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

like image 687
net user Avatar asked May 14 '14 16:05

net user


1 Answers

Since coreutils release 8.16 (2012-03-26) you can do:

split --numeric=1 -l 100 largeFile.txt smallFile.txt.
like image 184
pixelbeat Avatar answered Oct 13 '22 01:10

pixelbeat