Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

changing the output filenames in [split] [closed]

I would like to split a huge text file into separate text files. I use:

split -l 1000 file.txt split_file

and I will get split_fileaa, split_filebb, etc.

How can I change the extension to be

split_file0.txt, split_file1.txt, etc?

like image 288
Cokes Avatar asked Oct 23 '13 18:10

Cokes


2 Answers

There is a -d option for numeric suffixes.

like image 35
Michael Avatar answered Oct 12 '22 09:10

Michael


--additional-suffix is what you need for the additional suffix :

split -l 1000 -d --additional-suffix=.txt file.txt split_file
like image 137
svante Avatar answered Oct 12 '22 08:10

svante