Split a Single CSV File into Multiple Files Using the Split Command - Bash
Working with huge CSV files? Need to split them for easier management and analysis? Look no further - I will show you how to split large CSV files using the split
command in Bash. This quick guide will help you split your data like a pro!
Step 1: Open Your Terminal
To begin splitting your CSV files, open your terminal. You can use split
in Bash on Linux, macOS, or Windows with WSL (Windows Subsystem for Linux).
Step 2: Navigate to the File’s Directory
Navigate to the directory where your CSV file is located using the cd
command:
cd /path/to/your/csv/directory
Step 3: Splitting the CSV File
Use the split
command to divide your CSV file by specifying the number of lines in each new file:
split -l 1000 large_data.csv smaller_data_
This command will split large_data.csv
into smaller files, each containing 1000 lines. The new files will be named smaller_data_aa
, smaller_data_ab
, smaller_data_ac
, and so on.
Step 4: Verify the Split
To confirm that the split was successful, list the files in your directory:
ls
Looking for a skilled WordPress/WooCommerce developer? I'm currently available for freelance, contract, or full-time remote opportunities! Let's create something amazing together. Send me a quick message, and I'll respond within 24 hours!
Recent Posts
- Automating Code Linting with GitHub Actions for WordPress Plugins
- Comprehensive Guide to Linting PHP, JavaScript, and CSS in WordPress Plugins Using Composer
- The Ultimate Guide to Indexing in Database Design
- Understanding 'update_meta_cache' in WordPress - When to Use It, When Not to, and Its Impact on Database Queries
- A Guide to Configuring JavaScript and SCSS Paths in WordPress Plugins with @wordpress/scripts
Your Questions / Comments
If you found this article interesting, found errors, or just want to discuss about it, please get in touch.