datamash issue

Dave Stevens geek at uniserve.com
Fri Apr 24 22:29:01 UTC 2020


I've written a bash script that calls datamash to print an average
of a numeric reading that appears in column 3 of a text file; the
average is appended to the end of a file of similar readings. The line
of the script is like this:

cat /home/dave/node_modules/plantower/atbarrys/$target.csv | datamash
-W mean 3 -R 1 --no-strict
>> /home/dave/node_modules/plantower/atbarrys/aa

Sorry about the formatting but syntactically this is all right -
except for the part about "-R 1".

The intent is that the real number will be written with only one digit
to the right of the decimal, but an error is generated saying,

cat: /home/dave/node_modules/plantower/atbarrys/.csvdatamash: invalid
option -- 'R'


However when I tested datamash with a similar file and when typing
the command from the terminal I got

cat byminute.csv | datamash mean 1  -R 1
29.5

which is correct and as I wish it to be.

I can not see why one works and the other doesn't. Does anyone have a
suggestion?

Mint, GNU bash, version 4.3.48(1)-release-(x86_64-pc-linux-gnu)

TIA

dave




-- 
Affectionate tactile stimulation is a primary need, a need which must
be satisfied if the infant is to develop as a healthy human being.

And what is a healthy human being? One who is able to love, to work, to
play, and to think critically and unprejudicially.

--  Ashley Montagu – Touching, The human significance of the skin. 2e
1978




More information about the ubuntu-users mailing list