I need some help with shell script.
I have the following text file (open_calculator[1]):
value:0,0236679
value:0,0272904
value:0,0282416
value:0,0295671
value:0,0318641
value:0,032451
value:0,0333313
value:0,0360229
value:0,0364378
And I need to get the minimum value of this file and subtract it of the other values of the same text file. So my output should be:
value:0,0000000
value:0,0036225
value:0,0045737
.
.
.
value:0,0127699
In order to achieve this, I wrote this script:
file="open_calculator[1]"
min= cut -f2 -d ":" $file | sort -n | head -1
number=$(grep -o '[0-9],[0-9]*' $file)
resul=$((10#$number - 10#$min))
sed -i 's/value:$number/valor:$resul/' $file
but when I run this code, I get this message error:
line 6:10#0,0236679: value too great for base (error token is "0236679")
Someone could help me with this script? Sorry for my bad English, it's my first time writing here.
Thanks in advance!