Wacky_rubia

dicU

Jan 18th, 2014
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.34 KB | None | 0 0
  1. #!/bin/bash
  2. for i in $(cat 111); do
  3.     echo $i >> o
  4. done
  5. sort o >> l
  6. lastline=
  7. count=0
  8. for i in $(cat l); do
  9.     if [[ $lastline == $i ]]; then
  10.         let "count=$count+1"
  11.     else
  12.         if [[ $count > 0 ]]; then
  13.             echo $lastline=$count
  14.         fi
  15.         lastline=$i
  16.         count=1
  17.     fi
  18. done
  19. if [[ $count > 0 ]]; then
  20.     echo $lastline=$count
  21. fi
  22. rm o
  23. rm l
Advertisement
Add Comment
Please, Sign In to add comment