我的系统的awk指向mawk,想使用位运算,提示没有这类内置函数;在man手册里确实没有发现它提供内置的位运算函数
装上gawk后,在其man手册里找到了位运算内置函数的相关介绍,它提供位运算操作
Bit Manipulations Functions Starting with version 3.1 of gawk, the following bit manipulation func- tions are available. They work by converting double-precision floating point values to unsigned long integers, doing the operation, and then converting the result back to floating point. The functions are:
and(v1, v2) Return the bitwise AND of the values provided by v1 and v2.
compl(val) Return the bitwise complement of val.
lshift(val, count) Return the value of val, shifted left by count bits.
or(v1, v2) Return the bitwise OR of the values provided by v1 and v2.
rshift(val, count) Return the value of val, shifted right by count bits.
xor(v1, v2) Return the bitwise XOR of the values provided by v1 and v2.
|
阅读(2178) | 评论(0) | 转发(0) |