Created
September 13, 2013 06:56
-
-
Save yamingd/6547452 to your computer and use it in GitHub Desktop.
split big file on first column's value
This file contains 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
function splitBigFile() | |
{ | |
tail -n 1000000000 $1 | awk '{ | |
subNum=substr($1,length($1)-1) | |
print subNum,$0 | |
}' | while read subNum others | |
do | |
echo $others >> $2.$subNum | |
done | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
tail -n 10000 member_pv.tmp | awk '{a=$1%100; print $0 > "mid_"a".txt"}'