[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Bug when adding negative numbers
From: |
Erik Auerswald |
Subject: |
Re: Bug when adding negative numbers |
Date: |
Fri, 12 Feb 2021 08:06:27 +0100 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
Hi,
On Thu, Feb 11, 2021 at 04:43:19PM -0800, Shawn Wagner wrote:
> On Thu, Feb 11, 2021 at 3:50 PM Saint Michael <venefax@gmail.com> wrote:
> >
> > I have a list of values, and if I type
> > datamash sum 1
> > 'atamash: invalid numeric value in line 1 field 1: '-500
> >
> > This is my list
> > -500
> > -100
> > -87.33
> > -600
> > -116.43
> > -500
> > -1000
> > -171.67
> > -112.84
> > -171.67
> >
> > I think datamash must handle negative numbers,
>
> Looks like your data file has Windows style CRLF endings and you're on a
> Unixish system that uses LF line endings. Run dos2unix or the like on it
> and try again.
I had another problem with your input data caused by locale settings:
$ datamash sum 1 < negative_numbers
datamash: invalid numeric value in line 3 field 1: '-87.33'
$ env LC_NUMERIC=C datamash sum 1 < negative_numbers
-3359.94
$ tr . , < negative_numbers | datamash sum 1
-3359,94
Thanks,
Erik
--
Always use the right tool for the job.
-- Rob Pike