Reputation: 1216
I wish to convert string to int in shell script (ksh shell)
The string looks like 1.2E+002
Which is basically a number 120
I wanted to compare this number with say 100.
But, I am unable to do so.
Looked at other answers on stackoverflow, but none works for my case
Upvotes: 1
Views: 309
Reputation: 124714
You could use Awk's int
:
$ echo "1.2E+002" | awk '{ print int($0) }'
120
Upvotes: 3