简体   繁体   中英

Bash/Linux - Compare decimal numbers in a script, data from a .csv column

I am trying to compare the decimal numbers in a column one by one. These comparisons are made with respect to constants.

I want to count the number of times the condition is true. But this part is ok.

The file with the data is a csv separated by ";"and the decimals are separated by a "."

I have the following code, but I have not achieved anything.

fixed_acidity_filter=$(awk 'BEGIN{FS=";"} {if($1>0 && $1<15) ]{print}}' winequality-white_sincabecera.csv | wc -l)

Can anyone help me?

# concept
echo -e "20\n10\n18\n15\n13\n21" | awk '{if($1>0 && $1<15) print $1}'
# your code
echo -e "20;10\n10;10\n18;10\n15;10\n13;10\n21;10" | awk 'BEGIN{FS=";"} {if($1>0 && $1<15) print $1}' | wc -l

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM