AWK小结
来源:互联网 发布:比邻软件 编辑:程序博客网 时间:2024/05/21 13:58
介绍
Awk是一门脚本语言,在linux下面有一个awk工具,一般配合sed工具使用
The AWK Programming Language(book)
Awk处理流程
- Awk reads all input either from standard input or files.
- The input is read in unit called records, default is a line
- Each record will processed by rule of the program, and will split to chunks called fields.
Awk关键字
Awk语法
- BEGIN{action //here put the code that will processed before read record like define some variables, if not need, ignore it }
- //match pattern {action//here put the code will be processed in every record} (Can be more than ones)
- END {action //here put the code will be processed after all record all processed, if not need, ignore it }
用例
用例1
awk ‘{print $3, $9, $5 }’
awk ‘NR!=1 {print $3, $9, $5 }’
awk ‘NR!=1 {printf “%-10s %-25s %10s\n”,$3, $9, $5 } ’
awk ‘NR!=1 && $3==”ewajinx” {printf “%-10s %-25s %10s\n”,$3,$9, $5 }’
用例2
awk ‘BEGIN{print “calculating …..”} {sum+=$5} END {print sum}’
用例3
可以使用-F指定其他分割符.
cat file.txt | awk -F, ‘{print
命令输出结果为:Adam Bor, IndiaKerry Miller
阅读全文
0 0
- awk小结
- awk小结
- AWK小结
- awk用法小结
- awk 用法小结
- awk(gawk)用法小结
- awk用法小结
- awk用法小结
- awk用法小结
- awk用法小结
- awk用法小结
- linux awk用法小结
- awk用法小结
- awk用法小结
- awk用法小结
- awk用法小结
- awk应用小结
- awk用法小结
- AD10长方形通孔焊盘的画法
- ORcaleClient11 + PL/SQL 安装连接Orcale数据库
- 自学编程需要注意什么?
- 添加QDialog的Layout布局属性操作
- 第三方新浪微博登录接口的申请及使用流程之web+php
- AWK小结
- CSS选择器
- idea2017注册
- 记一款bug管理系统(bugdone.cn)的开发过程(2) -如何做好登录界面
- 【深度学习】写诗机器人tensorflow实现
- 《遗传算法的数学基础》阅读笔记 (2)_遗传机制和遗传算法。
- 生成ssl证书的步骤
- 大学最后的暑假开始
- Java类加载器加载类的过程