Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8353895
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T09:23:42+00:00 2026-06-09T09:23:42+00:00

I have a 2 GB CSV file that has a few columns and several

  • 0

I have a 2 GB CSV file that has a few columns and several millions of rows (including a date column formatted as 2010-12-15). I am looking to split this CSV into smaller CSVs that are arranged in folders by the date (for example all entries for December 15, 2010 are located inside a folder named 20101215).

I am fairly new to this stuff but am aware of split command. Can you guys point me in the right direction?

Thanks in advance!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T09:23:45+00:00Added an answer on June 9, 2026 at 9:23 am

    Depending on how regular and clean your data is, something like this may suffice:

    for i in `cut -d, -f 2  <csv | sort -u`; do
       mkdir $i && grep $i csv > $i/csv
    done
    

    (assuming your data is in the file csv, and your date info is in the second column)

    What is this doing ? The cut filters out the dates in the second column, and they’re run through sort -u to create a sorted list of unique dates. We then iterate through this (the for command) and for each entry we mkdir a corresponding directory, and grep results out into a csv file within that directory.

    It’s not ideal. e.g. we grep through the input file for each date. I’m assuming the data is regular, and that a date string (2012-08-06 for example) doesn’t appear elsewhere in your data (or has characters that would screw up the above script e.g. spaces and/or /).

    I don’t think the split command will help you here. It’s more useful for splitting files into regular chunks (by size or by number of lines).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a CSV file that has rows, where data for some columns only
I have a csv file that has like 30,000 rows in it. It also
I have a csv file that has 2 columns separated by a comma -
I have a csv file that has a date field in a format like
I have a .csv file that has data in a column, I need that
I have a csv file that has column values enclosed within double quotes. I
I have a CSV file that has only 1 column, but has close to
I have a CSV file that has 2999 rows but on importing it to
In short, I have a 20,000,000 line csv file that has different row lengths.
I have received a CSV that has been converted/compressed/compacted into a SAV file from

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.