- 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
- 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
- 4、该文档为VIP文档,如果想要下载,成为VIP会员后,下载免费。
- 5、成为VIP后,下载本文档将扣除1次下载权益。下载后,不支持退款、换文档。如有疑问请联系我们。
- 6、成为VIP后,您将拥有八大权益,权益包括:VIP文档下载权益、阅读免打扰、文档格式转换、高级专利检索、专属身份标志、高级客服、多端互通、版权登记。
- 7、VIP文档为合作方或网友上传,每下载1次, 网站将根据用户上传文档的质量评分、类型等,对文档贡献者给予高额补贴、流量扶持。如果你也想贡献VIP文档。上传文档
查看更多
Shell 5
5.2.2 Input from Commands
The output from a UNIX command or commands can be piped to awk for processing. Shell programs commonly use awk for manipulating commands.
UNIX命令的输出可以用过pipe交给awk处理,shell 编程通常使用awk处理数据。
FORMAT
% command | nawk pattern
% command | nawk {action}
% command | nawk pattern {action} Example 5.4
1 % df | nawk $4 75000
/oracle (/dev/dsk/c0t0d057 ):390780 blocks 105756 files
/opt (/dev/dsk/c0t0d058 ):1943994 blocks 49187 files
2 % rusers | nawk /root$/{print $1}
owl
crow
bluebird
EXPLANATION
The df command reports the free disk space on file systems. The output of the df command is piped to nawk (new awk). If the fourth field is greater than 75,000 blocks, the line is printed.
df命令报告系统的剩余磁盘空间,df命令的输出结果通过管道提交给awk,如果第4个field比75,000blocks大,那么这行将被打印出来
The rusers command prints those logged on remote machines on the network. The output of the rusers command is piped to nawk as input. The first field is printed if the regular expression root is matched at the end of the line ($); that is, all machine names are printed where root is logged on.
rusers命令打印出那些通过网络连接到主机的终端,rusers命令的输出pipe到awk作为awk的输入,他会打印第一个field如果匹配第正则表达式root。 5.3 Formatting Output
5.3.1 The print Function
The action part of the awk command is enclosed in curly braces. If no action is specified and a pattern is matched, awk takes the default action, which is to print the lines that are matched to the screen. The print function is used to print simple output that does not require fancy formatting. For more sophisticated formatting, the printf or sprintf functions are used. If you are familiar with C, then you already know how printf and sprintf work.
Awk命令中的Action包含在大括号内,如果没有指定 action并且有匹配pattern的行,awk会执行默认action,将这些匹配的行,打印的屏幕上。Print函数可以用来打印简单的输出,没有特殊要求的格式的。如果想要更多复杂的格式,请使用printf或者sprintf函数。如果你对C语言狠熟悉,那么你已经知道printf和sprintf该如何使用。
The print function can also be explicitly used in the action part of awk as {print}. The print function accepts argumen
您可能关注的文档
- PowerDesigner_OOM.ppt
- Power System and Management (DRONAH-2006).ppt - HPSLDC.ppt.ppt
- PowerHA配置步骤.docx
- pomotime软件使用说明番茄工作法.docx
- PNG格式.doc
- PPt for ARCPs 201010.pptx
- PPS_03_8D_January__03-B-2.ppt
- pptch7.ppt
- PPT模型大全.ppt
- PPT素材-正文-factor4.ppt
- Sigma Delta modulator with order=2,3,4 in frac-PLL.ppt
- Slope fields.ppt
- SMT 初学100题.doc
- smthome_电路板絤装之焊接.doc
- SMT零件和PTH(M.pptx
- Socio-technical systems From design methods to systems engineering.doc
- Software Engineeing--Lesson 2--Modeling process and life cycle.ppt
- snacks procedure.ppt
- Solar Energy Utilization in China.ppt
- Solar_Energy.ppt
原创力文档


文档评论(0)