Skip to content

Instantly share code, notes, and snippets.

@tmuth
Created June 2, 2014 15:10
Show Gist options
  • Save tmuth/63b964a6dc76e4daa6bb to your computer and use it in GitHub Desktop.
Save tmuth/63b964a6dc76e4daa6bb to your computer and use it in GitHub Desktop.
Split a text file every n number of lines
#!/bin/bash
# parameter 1: file to split
# parameter 2: number of lines per file
echo "About to split file $1"
echo "every $2 lines"
md5sum $1 > $1.md5
split -l $2 $1 $1.split.
gzip -1 $1.split.*
md5sum $1.split.*.gz > $1.split.gz.md5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment