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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T10:20:15+00:00 2026-06-18T10:20:15+00:00

I wish to split a large file (with ~ 17M Lines of Strings) into

  • 0

I wish to split a large file (with ~ 17M Lines of Strings) into multiple files with varying number of lines in each chunk. Would it be possible to send in an array to the ‘split -l‘ command like this:

[
 1=>1000000,
 2=>1000537,
 ...
]

so as to send those many number of lines to each chunk

  • 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-18T10:20:16+00:00Added an answer on June 18, 2026 at 10:20 am

    Use a compound command:

    {
      head -n 10000 > output1
      head -n   200 > output2
      head -n  1234 > output3
      cat > remainder
    } < yourbigfile
    

    This also works with loops:

    {
      i=1
      for n in 10000 200 1234
      do
          head -n $n > output$i
          let i++
      done
      cat > remainder
    } < yourbigfile
    

    This does not work on OS X, where head reads and discards additional output.

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

Sidebar

Related Questions

I wish to: Reading in two files Split the files into individual strings Compare
Let's say we have a long string we wish to split into strings 64
I have a very long regular expression, which I wish to split into multiple
I have a large text file in the below format, which I wish to
I wish there was a way to split a #include directive across two lines,
How do you split a long piece of text into separate lines? Why does
I wish to split text into sentences. Can anyone help me? I also need
I wish to split an order to generate multiple work orders depending on the
I wish to split a text string into words separated by spaces. I use
I wish to use regular expressions to split words into groups of (vowels, not_vowels,

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.