0

After some greping and seding I manage to get a value from a csv cell and assign it to a variable (DBR).

Here come some odd findings

echo $DBR
echo "$DBR",
printf "%f" $DBR

output:

9.1
,.1
: invalid numbersh: line 25: printf: 9.1
  • thx that was it; if you'd like you can post it as an answer so I can accept it; – pkaramol Mar 1 at 11:40
2

Your greping and seding has failed to remove a trailing carriage return from the value of DBR (perhaps originating from DOS-style line endings in the original CSV file).

Ex. given

$ printf -vDBR '9.1\r'
$ echo "$DBR" | xxd
00000000: 392e 310d 0a                             9.1..

then

$ echo $DBR
9.1
$ echo "$DBR",
,.1
$ printf '%f\n' "$DBR"
: invalid number1
0.000000

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.