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

  • SEARCH
  • Home
  • 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 6652129
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T01:05:52+00:00 2026-05-26T01:05:52+00:00

I have a 35 MB Excel file with these columns: Index, Name, Year, AgeGroup1,

  • 0

I have a 35 MB Excel file with these columns:

Index, Name, Year, AgeGroup1, AgeGroup2, AgeGroup3 [...]
1, Sweden, 1950, 20, 25, 27
2, Norway, 1950, 22, 27, 28
2, Sweden, 1951, 24, 24, 22

I’d like to split the file into several csv files based on the “Name” column (and preferably also name the files based on the value in this column).
I’d also like the files to be sorted by “Year” (but this could of course be done in Excel beforehand.)

A bash script or Kettle/Pentaho solution would be much appreciated. (Alternatives are also welcome.)

  • 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-05-26T01:05:53+00:00Added an answer on May 26, 2026 at 1:05 am

    i just used the example data you pasted there.

    awk oneliner can do it for you:

     awk -F, 'NR==1{title=$0;next} { print >> ($2".csv");colse}' yourCSV
    

    see below test:

    kent$  l  
    total 4.0K
    -rw-r--r-- 1 kent kent 136 2011-10-05 11:04 t
    
    kent$  cat t
    Index, Name, Year, AgeGroup1, AgeGroup2, AgeGroup3
    1, Sweden, 1950, 20, 25, 27
    2, Norway, 1950, 22, 27, 28
    2, Sweden, 1951, 24, 24, 22
    
    
    kent$  awk -F, 'NR==1{title=$0;next} { print >> $2".csv"}' t
    
    kent$  head *.csv
    ==>  Norway.csv <==
    2, Norway, 1950, 22, 27, 28
    
    ==>  Sweden.csv <==
    1, Sweden, 1950, 20, 25, 27
    2, Sweden, 1951, 24, 24, 22
    

    update

     awk -F, 'NR>1{ fname=$2".csv"; print >>(fname); close(fname);}' yourCsv
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two columns of integers between 1 and 16 in an excel file.
I have an excel file in which there are 10 columns with the data
I have an Excel (or CSV) file that contains the following flattened columns: ID,XPath,Required?,BaseType,Restrictions
I have an excel file that contain columns of data, my target is to
I have an excel file that has ~10 columns and 1-20 rows. I need
I have an Excel file that has columns A and B, both have data
I have one Excel file that contains 2 columns: Words & Definition (3000 rows).
I have a fairly large Excel file. In this file there is a column
I have an excel file, validating one column to enter numbers only but it
I have a excel file which is as follows . 1 Kr Veerappan 123

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.