龙盟编程博客 | 无障碍搜索 | 云盘搜索神器
快速搜索
主页 > 操作系统 > LINUX系统 >

Linux Shell输出命令实例

时间:2011-03-20 22:37来源:未知 作者:admin 点击:
分享到:
[root@root 2009521]# cat shell mma7450 0-001d: reg0x00: 000 0x00 mma7450 0-001d: reg0x01: 000 0x00 mma7450 0-001d: reg0x02: 000 0x00 mma7450 0-001d: reg0x03: 000 0x00 mma7450 0-001d: reg0x04: 000 0x00 mma7450 0-001d: reg0x05: 000 0x00 mma74

  [root@root 2009521]# cat shell

  mma7450 0-001d: reg0x00: 000 0x00

  mma7450 0-001d: reg0x01: 000 0x00

  mma7450 0-001d: reg0x02: 000 0x00

  mma7450 0-001d: reg0x03: 000 0x00

  mma7450 0-001d: reg0x04: 000 0x00

  mma7450 0-001d: reg0x05: 000 0x00

  mma7450 0-001d: reg0x06: 000 0x00

  mma7450 0-001d: reg0x07: 000 0x00

  mma7450 0-001d: reg0x08: 000 0x00

  mma7450 0-001d: reg0x09: 000 0x00

  mma7450 0-001d: reg0x0a: 000 0x00

  head命令

  [root@root 2009521]# head -n 4 shell

  mma7450 0-001d: reg0x00: 000 0x00

  mma7450 0-001d: reg0x01: 000 0x00

  mma7450 0-001d: reg0x02: 000 0x00

  mma7450 0-001d: reg0x03: 000 0x00

  [root@root 2009521]# head -4 shell

  mma7450 0-001d: reg0x00: 000 0x00

  mma7450 0-001d: reg0x01: 000 0x00

  mma7450 0-001d: reg0x02: 000 0x00

  mma7450 0-001d: reg0x03: 000 0x00

  诸如此类的命令:tail

  grep 的使用

  [root@root 2009521]# grep -n 'reg0x0[0-3]' shell

  1:mma7450 0-001d: reg0x00: 000 0x00

  2:mma7450 0-001d: reg0x01: 000 0x00

  3:mma7450 0-001d: reg0x02: 000 0x00

  4:mma7450 0-001d: reg0x03: 000 0x00

  awk的使用

  [root@root 2009521]# awk '/reg0x0[0-3]/' shell

  mma7450 0-001d: reg0x00: 000 0x00

  mma7450 0-001d: reg0x01: 000 0x00

  mma7450 0-001d: reg0x02: 000 0x00

  mma7450 0-001d: reg0x03: 000 0x00

  [root@root 2009521]# awk '{if($3~/reg0x0[0-3]:/)print $0;}' shell

  mma7450 0-001d: reg0x00: 000 0x00

  mma7450 0-001d: reg0x01: 000 0x00

  mma7450 0-001d: reg0x02: 000 0x00

  mma7450 0-001d: reg0x03: 000 0x00

  [root@root 2009521]# awk '$3=="reg0x03:"{print $0}' shell

  mma7450 0-001d: reg0x03: 000 0x00

  [root@root 2009521]# awk '$3=="reg0x03:"' shell

  mma7450 0-001d: reg0x03: 000 0x00

[1] [2] 下一页

精彩图集

赞助商链接