saba01
1
Hello,
I have this file file1.csv
Element1;23-10-2012;1,450;1,564;1,428
Element2;23-10-2012;1,448;1,565;1,427
Element3;23-10-2012;1,453;1,570;1,424
Element4;23-10-2012;1,428;1,542;1,405
Element5;23-10-2012;1,461;;1,453
Element6;23-10-2012;1,438;1,555;1,417
Element7;23-10-2012;1,458;1,575;1,450
Element8;23-10-2012;1,453;;1,427
Element9;23-10-2012;1,407;;1,377
and need calculate minimum value of colums 3,4 and 5
I use awk, in colum 3 work well
awk 'min=="" || $3 < min {min=$3;gaso=$3} END{ print gaso}' FS=";" file1.csv
1,407
but in colum 4 not print any results because are rows with empty fields
how I can calculate the minimum value of column 4 without empty values?
thanks in advance
awk -F\; 'NR==1{min=$4;next} $4<min && $4+0 > 0{min=$4}END{print min}' file1.csv
1 Like
saba01
3
thanks itkamaraj !!!
work ok
and minimum only the first 10 rows and (without the last row)?
what you mean by first 10 rows and without last row ?
you want to check the minimum value in the first 10 rows ?
saba01
5
Yes, check the minimum value in the first 10 rows without empty values
the last row always has the minimum value
$ awk -F\; 'NR>10{exit} NR==1{min=$4;next} NR<=10 && $4<min && $4+0 > 0{min=$4}END{print min}' file1.csv
1,542
1 Like
saba01
7
is just what I wanted, works well
thanks again !!!