Skip to content

Instantly share code, notes, and snippets.

@verajosemanuel
Last active March 25, 2021 16:55
Show Gist options
  • Save verajosemanuel/57c7b5bf4b0922b288ac16fca9dde47c to your computer and use it in GitHub Desktop.
Save verajosemanuel/57c7b5bf4b0922b288ac16fca9dde47c to your computer and use it in GitHub Desktop.
#split #file by #lines in #bash
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