• Uncategorized

About bash : changing-the-output-filenames-in-split-closed

Question Detail

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?

Question Answer

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

split -l 1000 -d --additional-suffix=.txt file.txt split_file

There is a -d option for numeric suffixes.

You may also like...

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.