Created
November 17, 2019 16:10
-
-
Save pganti/aa8c86315bcce0c96c6027bf5d29a609 to your computer and use it in GitHub Desktop.
json splitter
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
FILENAME=$1 | |
FILESTEM=`echo "$FILENAME" | cut -d'.' -f1` | |
NUM_FILES=$2 | |
# Hack to get the right number of files | |
NUM_FILES=$((NUM_FILES-1)) | |
LC=`wc -l $FILENAME | awk '{print $1}'` | |
LC_FILE=$((LC / NUM_FILES)) | |
echo 'Going to split the files now ...' | |
split -l $LC_FILE $FILENAME ${FILESTEM}-Part # Split the file into chunks of 20 lines each | |
echo 'All the split files are now ready' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment