Advertisement
Guest User

Untitled

a guest
Jul 24th, 2019
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. export LC_CTYPE=C
  2. COL=$1
  3. FILE=$2
  4. SEP=$3
  5. awk -v col="$COL" -F $"$SEP" ' {c[$col]++;}
  6. END{
  7. 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]); }
  8. }' $FILE
  9.  
  10. EXPLICIT "damn you're lookin' at the truth the money never lie..."
  11. NOT_EXPLICIT "give me a run for my money there is nobody..."
  12.  
  13. ./count_classes.sh 1 /root/my_dataset.tsv "t"
  14.  
  15. 1 NOT_EXPLICIT 6226 0
  16. 2 EXPLICIT 7433 6226
  17.  
  18. EXPLICIT "damn you're lookin' at the truthnthe money never lie..."
  19. NOT_EXPLICIT "give me arnrun for my moneynnthere is nobody..."
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement