Skip to content

Instantly share code, notes, and snippets.

@holysoros
Created March 22, 2019 08:21
Show Gist options
  • Save holysoros/c3b60ec62607bf33dcc2f7aa3cb23a7a to your computer and use it in GitHub Desktop.
Save holysoros/c3b60ec62607bf33dcc2f7aa3cb23a7a to your computer and use it in GitHub Desktop.
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