Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [eric@vm18 ~]$ cat xxx.log
- Cmp1_F: 10.123
- Cmp2_F: 112.123
- Cmp3_F: 1012.123
- Cmp4_F: 1512.123
- [eric@vm18 ~]$ cat test2.sh
- ##COMPARISON
- Amount=5
- UPPER=1234.567
- LOWER=12.3456
- for(( Num=1 ; Num<$Amount ; Num++ ))
- do
- eval Cmp${Num}_F=$(cat xxx.log | grep Cmp${Num}_F | awk '{ print $2 }')
- done
- for(( Num=1 ; Num<$Amount ; Num++ ))
- do
- eval "tmp=\${Cmp${Num}_F}"
- if [ `echo $tmp'>'$UPPER | bc -l` -eq 1 ] || [ `echo $tmp'<'$LOWER | bc -l` -eq 1 ]; then
- echo "Data $tmp is Not in Range"
- else
- echo "Data $tmp is in Range From : ($LOWER ~ $UPPER)"
- fi
- done
- [eric@vm18 ~]$ bash test2.sh
- Data 10.123 is Not in Range
- Data 112.123 is in Range From : (12.3456 ~ 1234.567)
- Data 1012.123 is in Range From : (12.3456 ~ 1234.567)
- Data 1512.123 is Not in Range
- [eric@vm18 ~]$
Advertisement
Add Comment
Please, Sign In to add comment