Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- export LC_CTYPE=C
- COL=$1
- FILE=$2
- SEP=$3
- awk -v col="$COL" -F $"$SEP" ' {c[$col]++;}
- END{
- p=1; tot=0; for (i in c) { printf("%s'$SEP'%s'$SEP'%s'$SEP'%sn",p,i,c[i],tot);p++;tot+=i>0?c[i]:(c[i]+c[i-1]); }
- }' $FILE
- EXPLICIT "damn you're lookin' at the truth the money never lie..."
- NOT_EXPLICIT "give me a run for my money there is nobody..."
- ./count_classes.sh 1 /root/my_dataset.tsv "t"
- 1 NOT_EXPLICIT 6226 0
- 2 EXPLICIT 7433 6226
- EXPLICIT "damn you're lookin' at the truthnthe money never lie..."
- NOT_EXPLICIT "give me arnrun for my moneynnthere is nobody..."
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement