csv - Getting wrong results with awk -
i have dataset trying select rows values in column called ambienf
greater 20.
first, find column number:
$ csvcut -n head.csv | grep ambienf 287: ambienf
next, @ values:
$ csvcut -c name,ambienf head.csv | head -n 25 | csvlook |-----------+-------------------| | name | ambienf | |-----------+-------------------| | 87892625 | | | 87881401 | 31.3340396881104 | | 87881407 | 23.3398342132568 | | 87881397 | | | 87892628 | | | 87892632 | | | 87881394 | 28.8716373443604 | | 87790338 | | | 87797472 | | | 87788161 | 32.2283515930176 | | 87790894 | 32.7088813781738 | | 87871678 | 25.5556793212891 | | 87767487 | 33.3377380371094 | | 87759792 | | | 87751064 | | | 87772221 | | | 87751071 | | | 87751061 | | | 87751067 | | | 87772224 | | | 87756101 | 32.2252311706543 | | 87747384 | 30.0030345916748 | | 87767382 | 22.2242679595947 | | 87720411 | | | 87728035 | | | 87711021 | | |-----------+-------------------|
now, want select name ($3) , ambienf ($287) ambienf > 20:
$ awk -f , '$287 > 20 {print $3 "," $287}' head.csv name ambienf
^ that’s output. if awk -f, '{print $3 "," $287}' head.csv | head -20 | csvlook
, same result csvcut -c name,ambienf
command above.
any troubleshooting appreciated!
the issue numerical values reason being quoted. found version of dataset numbers unquoted, , commands ran on it. @karakfa!
Comments
Post a Comment