Split Excel CSV into Multiple files using Bash script

Split Excel CSV into Multiple files using Bash script

Split Excel CSV into Multiple files using Bash script. For example if you have a csv with more than 15000 products, and you have to split it into small file with 100 or 200 products in each file. It can be very difficult.In this article, i wrote an Bash Script, to Split Excel CSV into Multiple files using Bash script.

Split Excel CSV into Multiple files using Bash script

For this, we have to create a hash script file, named as split.sh
And write the following lines to it.

Ok.Lets go little bit deep into the code.

Give the filename of the CSV/TXT. For example file.csv or file.txt
You can give values of counter or just avoid that part.
If you number your splitted files with name you can give the total number of files that you are expecting to in the COUNTER variable.
And the starting number of file in the the start variable.

To Run:
Place the split.sh in the exact same folder of the csv/txt file.
Open a terminal in the same folder and type :

You can see the splitted files in the same folder. If you can’t see just refresh the folder using the function key F5.

Download the Split.sh file from here : Download here

I hope you got enough knowledge from this article to Split Excel CSV into Multiple files using Bash script.If you have any doubt, drop below. Thanks for reading.

Leave a Comment

Your email address will not be published. Required fields are marked *