Skip to content

Instantly share code, notes, and snippets.

@nkkarthik
Created November 26, 2019 14:48
Show Gist options
  • Save nkkarthik/f99417e0727f347844cae1f6e0ba49ab to your computer and use it in GitHub Desktop.
Save nkkarthik/f99417e0727f347844cae1f6e0ba49ab to your computer and use it in GitHub Desktop.
$outdir = 'splitout'
def split file
base = File.basename file
if File.size(file) < 10000000
puts `cp #{file} #{$outdir}/#{base}`
else
puts `zcat #{file} | split - -l 1000000 --filter='gzip > $FILE.gz' #{$outdir}/#{base[0..-3]}`
end
end
split ARGV[0]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment