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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T16:41:55+00:00 2026-05-11T16:41:55+00:00

I have a really big log file (9GB — I know I need to

  • 0

I have a really big log file (9GB — I know I need to fix that) on my box. I need to split into chunks so I can upload it to amazon S3 for backup. S3 has a max file size of 5GB. So I would like to split this into several chunks and then upload each one.

Here is the catch, I only have 5GB on my server free so I can’t just do a simple unix split. Here is what I want to do:

  1. grab the first 4GB of the log file and spit out into a seperate file (call it segment 1)
  2. Upload that segment1 to s3.
  3. rm segment1 to free up space.
  4. grab the middle 4GB from the log file and upload to s3. Cleanup as before
  5. Grab the remaining 1GB and upload to S3.

I can’t find the right unix command to split with an offset. Split only does things in equal chunks and csplit doesn’t seem to have what I need either. Any recommendations?

  • 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-11T16:41:55+00:00Added an answer on May 11, 2026 at 4:41 pm

    One (convoluted) solution is to compress it first. A textual log file should easily go from 9G to well below 5G, then you delete the original, giving you 9G of free space.

    Then you pipe that compressed file directly through split so as to not use up more disk space. What you’ll end up with is a compressed file and the three files for upload.

    Upload them, then delete them, then uncompress the original log.

    =====

    A better solution is to just count the lines (say 3 million) and use an awk script to extract and send the individual parts:

    awk '1,1000000 {print}' biglogfile > bit1
    # send and delete bit1
    
    awk '1000001,2000000 {print}' biglogfile > bit2
    # send and delete bit2
    
    awk '2000001,3000000 {print}' biglogfile > bit3
    # send and delete bit3
    

    Then, at the other end, you can either process bit1 through bit3 individually, or recombine them:

    mv bit1 whole
    cat bit2 >>whole ; rm bit2
    cat bit3 >>whole ; rm bit3
    

    And, of course, this splitting can be done with any of the standard text processing tools in Unix: perl, python, awk, head/tail combo. It depends on what you’re comfortable with.

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

Sidebar

Related Questions

I have a really big .less file that I am trying to break into
I have an application generating a really heavy big log file every days (~800MB
I have a really big property list file(approximately 2 MB large) and I need
I have a website that just takes a really big form and saves the
I have an NodeJS Express app that is getting really big in just one
I have a really big project that will use for example mails, contacts and
I have I really big problem in this website http://emprego.xtreemhost.com/log/emprego.php To see the problem
I have really big Oracle table with many columns that are not relevant to
I really have big problems with importing an extern C-Library to my existing C++-Project.
I have been a really big fan of stackoverflow(which led me to ask the

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.