Casting to int in awk

前端 未结 3 881
猫巷女王i
猫巷女王i 2021-01-03 22:07

I\'m looking for a method to cast a string to an int in awk. I have the following which appears to be doing a string comparison

(note: field

3条回答
  •  佛祖请我去吃肉
    2021-01-03 22:52

    Most new awks have an int() function.

    But the method for casting documented in 'The Awk Programming Language' is shown as you do it, by using numericValue and +0. I don't have the book handy, but I think you can also cast for float value by using +0.0.

    I hope this helps.

提交回复
热议问题