- 浏览: 2002645 次
- 性别:
- 来自: 北京
文章分类
- 全部博客 (651)
- ACE (35)
- BAT (9)
- C/C++ (116)
- fast-cgi (14)
- COM (27)
- python (59)
- CGI (4)
- C# (2)
- VC (84)
- DataBase (29)
- Linux (96)
- P2P (6)
- PHP (15)
- Web (6)
- Memcached (7)
- IME输入法 (11)
- 设计模式 (2)
- 搜索引擎 (1)
- 个人情感 (4)
- 笔试/面试 (3)
- 一亩三分地 (33)
- 历史 (2)
- 地理 (1)
- 人物 (3)
- 经济 (0)
- 不仅仅是笑哦 (43)
- 小故事大道理 (2)
- http://www.bjdsmyysjk120.com/ (0)
- http://www.bjdsmyy120.com/ (0)
- 它山之石可以攻玉 (15)
- 大学生你关注些什么 (28)
- 数据恢复 (1)
最新评论
-
luokaichuang:
这个规范里还是没有让我明白当浏览器上传文件时,STDIN的消息 ...
FastCGI规范 -
effort_fan:
好文章!学习了,谢谢分享!
com技术简介 -
vcell:
有错误os.walk(strPath)返回的已经是全部的文件和 ...
通过python获取目录的大小 -
feifeigd:
feifeigd 写道注意:文章中的CPP示例第二行 #inc ...
ATL入门:利用ATL编写简单的COM组件 -
feifeigd:
注意:文章中的CPP示例第二行 #include " ...
ATL入门:利用ATL编写简单的COM组件
a.txt andy 05/99 48311 Green 8 40 44 congfeng 06/99 4317 green 9 24 26 ljb 02/99 48 Yellow 12 35 28 carl 07/99 4842 Brown-3 12 16 26 rich 05/99 4712 Brown-2 12 30 28 [root@localhost shell]# awk '{ print $0 }' a.txt [root@localhost shell]# awk '{ print $1,$4}' a.txt #单独使用begin/BEGIN都可以,但是要使用begin-end的方式。必须全部大写:BEGIN-END [root@localhost shell]# awk 'BEGIN {print "hello, andylin!\nName\tBelt\n"} [root@localhost shell]# awk 'begin {print "hello,andylin!\nName\tBelt"} {print $1, $4} END {print"end of awk"} ' a.txt [root@localhost shell]# awk '{if ($4 ~ /Brown/ ) print $0}' a.txt [root@localhost shell]# awk '$3=="48" {print $0}' a.txt [root@localhost shell]# awk '$0 !~ /Brown/' a.txt [root@localhost shell]# awk '{if($0 !~ /Brown/) print$0}' a.txt [root@localhost shell]# awk '{if ($4 !="Brown-2") print$0}' a.txt [root@localhost shell]# awk '{if($6<$7) print$0} ' a.txt [root@localhost shell]# awk '{if($6 <= $7) print $0}' a.txt [root@localhost shell]# awk '/[Gg]reen/' a.txt [root@localhost shell]# awk '{if($0~/[Gg]reen/) print $0}' a.txt [root@localhost shell]# awk '{if ($1=="andy" && $4=="Green") print $0}' a.txt [root@localhost shell]# awk '{if ($1=="andy" || $4=="Green") print $0}' a.txt awk 'BEGIN {print ARGC,"_" FS, "_"} {print NF,NR} ' a.txt awk 'END{print NR,$NF,FILENAME}' a.txt [root@localhost shell]# echo $PWD | awk -F/ '{print $NF}' [root@localhost shell]# pwd | awk -F/ '{print $NF}' [root@localhost shell]# awk '{name=$1;belts=$4; if (belts ~/Yellow/) print name " is belt " belts}' a.txt [root@localhost shell]# awk 'BEGIN {BASELINE="27 "} {if($6 < BASELINE) print $0}' a.txt [root@localhost shell]# awk 'BEGIN {BASELINE=27} {if($6 < BASELINE) print $0}' a.txt [root@localhost shell]# awk '{if($1=="andy"){$1="aaa"}; print $1}' a.txt [root@localhost shell]# awk '{if($1 > "cc") print$1,$2}' a.txt [root@localhost shell]# awk '{if($1 > "cc") {}; print$1,$2}' a.txt [root@localhost shell]# awk 'BEGIN{print"Name\tDifference"} {if($6<$7){$8=$7- $6;print$1,$8}}' a.txt [root@localhost shell]# awk '{total += $6} END{print "total points:"total}' a.txt [root@localhost shell]# awk '{total += $6}{print$0} END{print "total points:"total}' a.txt [root@localhost shell]# ls -l | awk '/^[^d]/ {print $8"\t"$5} {total += $5} END{print "total KB:"total}' [root@localhost shell]# awk 'gsub(/4842/,1111){print$0}' a.txt [root@localhost shell]# awk 'gsub(/4842/,1111){print$0}' a.txt [root@localhost shell]# awk 'BEGIN {print "length($1)",length($1)} {print "length ($1):"length("a"$1)}' a.txt [root@localhost shell]# awk 'BEGIN {print split("123#456#678", arr, "#"),arr[0], arr[1], arr[2]}' [root@localhost shell]# echo "65" | awk '{printf"%c\n",$0}'; [root@localhost shell]# awk '{printf "%-15s %s\n", $1,$3}' a.txt [root@localhost shell]# who | awk '{print $1" you are connect "$2}' awk文件 #!/bin/awk -f BEGIN{ print("=========== Begin ================="); strRecord="123#456#789"; split(strRecord, arr, "#"); FS="\t"; }; { print $0; total += $6; } END{ for (i in arr) { print(arr[i]"\t"); } print("total val:", total); print("******* end of awk ***********"); };
发表评论
-
多机器执行ssh脚本
2012-08-30 18:12 2190#!/bin/bash Usage() { ... -
Berkeley DB 使用经验总结
2012-08-27 14:41 3032作者:陈磊 NoSQL是现在互联网Web2.0时代备受 ... -
嵌入式数据库系统Berkeley DB
2012-08-27 14:37 1480前言 UNIX/LINUX平台下的数据库种类非常多 ... -
shell中双引号的误用
2011-05-12 15:02 1134for i in "$LIST" ... -
shell for循环
2011-04-06 15:36 914for i in "1 2 3";do e ... -
shell技巧 除法
2011-03-07 11:34 19131shell计算中使用除法,基本默认上都是整除。 比如: ... -
.bash_profile 文件修改之后不执行
2011-02-16 11:21 1879重新登录 不可能不好用的 除非你是从一个用户su oralc ... -
SecureCRT中文显示乱码的解决方法
2011-02-12 11:38 1299最近开始用SecureCRT登陆linux系统,由于是新手,很 ... -
让putty显示中文
2011-02-11 14:43 1381对于经常在windows下远程ssh到linux的用户而言,p ... -
Linux文件类型全解析
2011-01-04 15:13 1366Linux文件类型全解析 ... -
Linux进程状态解析之T、Z、X
2011-01-04 15:09 1759摘要: Linux系统中进程有很多种 ... -
Linux进程状态解析之R、S、D
2011-01-04 14:54 4839摘要: Linu ... -
shell获取参数
2010-12-31 15:29 4135#!/bin/bash Usage() { ... -
Shell实现cgi接口示例
2010-12-30 14:59 1954ls -l /var/www/cgi-bin/ -rwxrw ... -
shell数组
2010-12-29 16:48 1256shell数组 Bash中还可以使用数 ... -
shell 自动化处理
2010-12-29 15:52 997#!/bin/bash sudo yum instal ... -
Linux用户添加sudoer
2010-12-29 11:37 24896使用sudo可以在以非root用户登录时临时获得root权限, ... -
lsof:一个功能强大的命令
2010-12-24 16:30 1325lsof:一个功能强大的命令 lsof命令的原始功能 ... -
linux 的库操作命令 ar和nm
2010-12-22 20:31 1367当我们的程序中有经 ... -
LINUX查看硬件配置 命令
2010-12-21 18:55 1023常用命令整理如下: 查看主板的序列号: dmidec ...
相关推荐
man 中文awk版内容包括:语法、AWK变量、操作符、语句的编写,数组和函数的书写内容。
Awk 是一种名称奇怪但功能强大的语言。本文是一个包含三部分的系列的第一...个真实的高级 awk 应用程序。 -------------------------------------------- 这是从 ibm 网站上看到的。觉得不错后制作成为 PDF,在此共享。
071204awk应用1
awk 应用程序原型安装说明:heroku 实例开始使用 mongodb 安装使用
这是awk最常被应用之处. 若能常常 如此处理问题, 读者可以以更高的角度来思考抽象的问题, 而不会被拘泥于细节的部份. 本手册为awk入门的学习指引, 其内容将先强调如何撰写awk程序,未列入进一步解题方式的应 用实例,...
创造者:Aho Wwinberger Kernighan 基于模式匹配检查输入文本,逐行处理并输出,通常用在shell中,获取指定的数据,单独使用时,可对文本数据做统计。
这本书对awk的编程模型、基本语法有简单明了的介绍,在进行数据处理、文本处理、报表、试验算法方面的应用也有很多好的实例。 由于是88年的老书,其中对gawk最新版本对awk的扩展没有提及,但这并不妨碍其称为一本...
在Linux中,AWK应用比较广泛,本文档介绍awk使用方法,内容详细,适合初学者使用!
sed和awk是用户、程序员和管理员应用的工具。之所以称为sed是因为它是一个流编辑器(stream editor),用于对许多文件执行一系列的编辑操作。awk是根据它的开发者Aho、Weinberger和Kernighan命名的。awk是一种编程...
sed和awk是用户、程序员和管理员应用的工具。之所以称为sed是因为它是一个流编辑器(stream editor),用于对许多文件执行一系列的编辑操作。awk是根据它的开发者aho、weinberger和kernighan命名的。awk是一种编程语言...
生产环境awk最佳实践
shell中色彩处理,awk高级应用, cut的基本使用,很多案例,可以实践
AWK-4121系列室外无线AP/网桥/客户端为工业应用提供了理想的 3合1无线解决方案,适用于不便接线、布线成本昂贵或使用移动 TCP/IP网络连接设备的场合
Awk 是一种使用方便且表现力很强的编程语言, 它可以应用在多种不同的计算与数据处理任务中. 这一章 是一个简短的教程, 目的是为了能让读者尽可能快地写出自己的awk 程序. 第二章对整个awk 语言进行描 述, 剩下的章节...
全面描述AWK命令的各种解释与应用,协助系统维护人员开发小程序,提升维护效率
详细介绍了linuxsed与awk的应用,值得学习 第三版
把实际应用中一些常用的awk的用法进行了总结,包括多文件操作,与shell之间的相互调用等
5.6: awk高级应用 、 综合案例 、 总结和答疑.docx