Skip to content

Instantly share code, notes, and snippets.

@ushiocheng
Created February 2, 2021 18:42
Show Gist options
  • Save ushiocheng/70a5247fa3a9b8ee671e8f102348abf5 to your computer and use it in GitHub Desktop.
Save ushiocheng/70a5247fa3a9b8ee671e8f102348abf5 to your computer and use it in GitHub Desktop.
splitting large file for transfer

Split large files into smaller files

Uses Shell command split

Splitting

# split file according to line count
split -l <line count> <file>

# split file according to segment size
split -b <size|ex.512m for 0.5GB segments> <file>

# split by RegEx, every segment would start with a match (maybe not for 1st segment)
split -p <RegEx> <file>

Combining

touch combined.ext
cat seg_aa > combined.ext
cat seg_ab >> combined.ext
cat seg_ac >> combined.ext
#...

Sources:

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