From Burly Plover, 3 Years ago, written in Plain Text.
Embed
  1. #!/bin/bash
  2.  
  3. filename='data.txt'
  4.  
  5. declare -a arr
  6.  
  7. n=0
  8. while read line; do
  9.     arr[$n]=$line
  10.     n=$((n+1))
  11. done < $filename
  12.  
  13. counter=0
  14. len=${#arr[@]}
  15. for (( index=3; index<$len; index++ )); do
  16.     if [[ ${arr[$index]}>${arr[$index-3]} ]]; then
  17.         counter=$((counter+1))
  18.     fi
  19. done
  20.  
  21. echo $counter
captcha