Chinaunix首页 | 论坛 | 博客
  • 博客访问: 657611
  • 博文数量: 102
  • 博客积分: 2241
  • 博客等级: 大尉
  • 技术积分: 1670
  • 用 户 组: 普通用户
  • 注册时间: 2010-03-08 10:08
文章分类

全部博文(102)

文章存档

2013年(6)

2012年(15)

2011年(81)

分类: 系统运维

2011-06-06 20:09:26


服务器上运行了多个 was server,要查全部 server 的进程 ID及 server name,不要中间一大段命令参数

  1. ps -ef | grep java | awk '{print $2,$NF}'




:split
-------------------------------------------------------------------
awk 变量: 来源 AIX 5.3 man

  $0  recode, $1 $2 ~=  split var

NF NR 在不同的段落下意义不同。

    NF
            The number of fields in the current record, with a limit of 99. Inside a BEGIN action, the NF special variable is undefined unless a getline function without a Variable parameter has been issued previously. Inside an END action, the NF special variable retains the value it had for the last recordread, unless a subsequent, redirected, getline function without a Variable parameter is issued prior to entering the END action.

  NR
            The number of the current input record. Inside a BEGIN action the value of the NR special variable is 0 (zero). Inside an END action, the value is the number of the last record processed.


  1. echo ab cd 12 34 | awk '{print $NR, $NF}'
结果是 ab 34

单行命令是 END action


:end






阅读(869) | 评论(0) | 转发(0) |
0

上一篇:ubuntu 无线

下一篇:waw s

给主人留下些什么吧!~~