Skip to content

Instantly share code, notes, and snippets.

@gamba
Last active October 20, 2019 06:54
Show Gist options
  • Save gamba/9fb163d3ce32c835c8a8afd7a3798906 to your computer and use it in GitHub Desktop.
Save gamba/9fb163d3ce32c835c8a8afd7a3798906 to your computer and use it in GitHub Desktop.
Split large mbox file with awk
BEGIN{chunk=0}
/^From /{
msgs++;if(msgs==1000){
close(("chunk_" chunk ".mbox")i);
msgs=0;chunk++
}
}
{print > ("chunk_" chunk ".mbox")}
@gamba
Copy link
Author

gamba commented Oct 20, 2019

awk -f split_mbox.awk <mbox_file>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment