Last active
March 25, 2021 16:55
-
-
Save verajosemanuel/57c7b5bf4b0922b288ac16fca9dde47c to your computer and use it in GitHub Desktop.
#split #file by #lines in #bash
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
for file in *.txt; do split -l 1 -d --additional-suffix=${${file}%.*}_$(uuidgen).xml $file;done | |
# split by size | |
split -b 256M --additional-suffix=.csv myfile.csv splitted_ | |
# split 5 parts taking lines | |
split --number=l/5 inputfile outputprefix --additional-suffix=.csv | |
#split keeping header | |
tail -n +2 operate.csv | split -l 2 - --filter='sh -c "{ head -n1 operate.csv; cat; } > $FILE"' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment