Hi, question is in the title.
I have a two column csv file (like below) and I tried to get the min value out of it.
0.24380519999999706,4.47
0.25453569999999814,2.06
0.2668407999999971,-3.05
0.2775802999999968,1.72
0.2885514999999934,2.69
I tried datamash but it keeps returning: invalid numeric value in line 1 field 1. (I also tried this: https://www.baeldung.com/linux/min-max-median-mean, script but it only returns the median value for some reason). So I have a bit of a workaround, where I first print the second column of the file into a different file and then use awk to find my minimal value and put it into another file. I was wondering if someone can help me with this so that I can do this with just one command line and only generate one file.
$ awk -F',' '{print$2}' test.csv > mintest.txt
$ min=$(awk '!/col/ {print $1}' mintest.txt | sort -nr | tail -1)
$ echo "$min" > mintest.csv
This works :) thank you. I am still new to this, I should look into some tutorials or do some more reading on working with linux