假设我们有一个充满时间和温度读数的csv文件,如果读数不在30到35的范围内,我们必须打印特定的时间和温度,以及总行数减去我们打印的标题和问题值。
而IFS="读取-r列1列2做如果["${Temp}";>35];然后回声;时间:$column1"温度:$column2";fidone<lt;(尾部-n+2 parse22.csv(
它打印整个文件。我想要不在30到35范围内的时间和温度,记录总数和打印的记录数
#To keep count of entries that comes under given condition
count=0
#Using while loop to separate the csv file into column through IFS and read command
while IFS=, read -r Time Temp
do
#Condition for passing
if [ $Temp -lt 30 ] || [ $Temp -gt 35 ];
then
echo "$Time $Temp"
#Printing the specified value
((++count))
#Adding the bad entry value to calculate
fi
done < <(tail -n +2 data1.csv)
#Ignoring the header and location csv file
echo ">> we found ${count} bad entries"
#Printing the value**