gawk中使用位运算和用例
来源:互联网 发布:武汉网页美工培训 编辑:程序博客网 时间:2024/06/06 05:21
(@转载请注明出处:http://blog.csdn.net/cmatch)
有时候需要在awk中使用位运算,来解决有些字段的解析、判断。但是一般的awk不支持此类运算,幸运的是gawk中可以支持此类运算。下面是手册中的说明:
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.
举例:
awk '$2=="A" && $3=="P" && and($4,0x00001)==1' /tmp/adzone.xml > tmp
- gawk中使用位运算和用例
- gawk脚本中使用bash脚本变量
- 位运算用例
- java中&和&&的区别 位运算
- PHP中逻辑或||和位运算符或的区别和使用注意事项
- 使用位运算实现乘法和乘方运算
- 使用位运算实现乘法和乘方运算
- 在gawk中 使用shell脚本中的变量
- gawk使用简介
- gawk 的使用例子
- gawk使用初步
- gawk 使用详解
- 位运算和移位运算
- 位运算和移位运算
- SHELL sed和gawk
- 初识sed和gawk
- 位运算符和位运算
- 位运算符和位运算
- JAVA方法参数传递技巧[转]
- computer english
- Javascript Function
- 什么是工作流
- JR 精品文章 - eclipse插件大全介绍,以及下载地址
- gawk中使用位运算和用例
- 黑客完全修炼手册(收藏)
- 深入分析C++中char * 和char []的区别
- 【MFC学习笔记2】MFC中的数据类型,全局变量,全局函数和宏。
- c#中什么情况下用(int)什么情况下用Convert.ToInt32
- 初识--WordPress
- Eclipse使用SVN[转].txt
- 自己两个月学习QT的学习心得!共享!希望能对新手有一点点帮助!
- bfd对多目标的支持