Guest User

Untitled

a guest
Aug 25th, 2017
235
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.81 KB | None | 0 0
  1. [eric@vm18 ~]$ cat xxx.log
  2. Cmp1_F:  10.123
  3. Cmp2_F:  112.123
  4. Cmp3_F:  1012.123
  5. Cmp4_F:  1512.123
  6.  
  7.  
  8.  
  9. [eric@vm18 ~]$ cat test2.sh
  10. ##COMPARISON
  11.  
  12. Amount=5
  13. UPPER=1234.567
  14. LOWER=12.3456
  15.  
  16. for((  Num=1 ; Num<$Amount ; Num++ ))
  17. do
  18.    eval Cmp${Num}_F=$(cat xxx.log | grep Cmp${Num}_F | awk '{ print $2 }')
  19. done
  20.  
  21. for(( Num=1 ; Num<$Amount ; Num++ ))
  22. do
  23.   eval "tmp=\${Cmp${Num}_F}"
  24.   if [ `echo $tmp'>'$UPPER | bc -l` -eq 1 ] || [ `echo $tmp'<'$LOWER | bc -l` -eq 1 ]; then
  25.     echo "Data $tmp is Not in Range"
  26.   else
  27.     echo   "Data $tmp is in Range From : ($LOWER ~ $UPPER)"
  28.   fi
  29. done
  30.  
  31.  
  32.  
  33. [eric@vm18 ~]$ bash test2.sh
  34. Data 10.123 is Not in Range
  35. Data 112.123 is in Range From : (12.3456 ~ 1234.567)
  36. Data 1012.123 is in Range From : (12.3456 ~ 1234.567)
  37. Data 1512.123 is Not in Range
  38.  
  39.  
  40.  
  41. [eric@vm18 ~]$
Advertisement
Add Comment
Please, Sign In to add comment