Skip to content

Instantly share code, notes, and snippets.

@holysoros holysoros/split.sh
Created Mar 22, 2019

Embed
What would you like to do?
Split data file into train and valid part.
#!/usr/bin/env bash
shuf $1 >random.txt
linenum=`wc -l random.txt | awk '{print $1}'`
validnum=$(($linenum/10))
trainnum=$(($validnum*9))
head -n $trainnum random.txt > notes.train
head -n $validnum random.txt > notes.valid
rm random.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.