Last active
January 8, 2021 05:36
-
-
Save metric-space/9e7ce85a1161095d07f2a7dd85ba2273 to your computer and use it in GitHub Desktop.
Revisions
-
Luke Meyers revised this gist
Jan 8, 2021 . No changes.There are no files selected for viewing
-
Luke Meyers created this gist
Jan 8, 2021 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,25 @@ inputfile=$1 filename="${inputfile%.*}" line_count=$(wc -l < $1) row_count=$((${line_count} - 1)) movement=$(($row_count/$2)) i=0 j=1 while [ $j -lt $row_count ] do # echo $(($j + 1)) # echo $(($j + $movement)) t="${filename}-${i}.csv" touch $t head -n 1 $1 > $t cat $1 | sed -n "$(($j + 1)),$(($j + $movement ))p" >> $t j=$[$j + movement] i=$[$i+1] done