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 8706391
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T03:36:09+00:00 2026-06-13T03:36:09+00:00

In a bash script, how do I split a large text/csv file into n

  • 0

In a bash script, how do I split a large text/csv file into n files (each of m rows); the resulting file names need to be numbered starting from 1 and increment by 1 [0,1…999…].

  • 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-13T03:36:11+00:00Added an answer on June 13, 2026 at 3:36 am

    The csplit command is pretty much made for this job:

    csplit -f output-csv. -n 4 -k input.csv 100 {2000}
    

    That will split input.csv into 100-line files for the first 200,000 lines in the file. The output files will begin output-csv. and will be followed by 4 digits. The -k means ‘do not clean up on receipt of a signal’. Adjust numbers according to size of input file and your whims and desires.

    Note the quirky behaviour of the first file, documented at the POSIX manual page linked to.

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

Sidebar

Related Questions

This bash script concatenates the names for jar files to a classpath (variable CP),
I have a large txt file space delimited which I split into 18 smaller
In a Bash script, I would like to split a line into pieces and
I have a simple bash script where I generate some temporary files using split,
Say I have a bash script file config.sh . It's meant to be source'd
I am writing a bash script where I need to create arrays inside a
I have a bash script that looks like the following: #!/bin/bash FILES=public_html/*.php # */
My bash script is zenity --question --text=Continue? && echo Continuing... How can I make
I have to split a string in a bash script by / but I
Part of a bash script I'm making involves rar splitting files and then moving

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.