Chinaunix首页 | 论坛 | 博客
  • 博客访问: 210358
  • 博文数量: 145
  • 博客积分: 3000
  • 博客等级: 中校
  • 技术积分: 1720
  • 用 户 组: 普通用户
  • 注册时间: 2009-07-14 18:42
文章分类

全部博文(145)

文章存档

2011年(1)

2009年(144)

我的朋友

分类: LINUX

2009-09-09 13:18:10

by tangke 2009-09-09

本文主要介绍cut命令的使用.

1.用法:cut -c m-n filename
  -c m-n 表示显示每一行的第m个字元到第n个字元。例如:
  
   ---------file-----------
   liubi 23 14000
  ---------file-----------
  # cut -c 3-9,12-20 file
  liubi 14000

2.用法:cut -f m-n filename 
  -f m-n 表示显示第m栏到第n栏(使用tab分隔)。例如:
   ---------file-----------
  liubi 23 14000
  ---------file-----------
  # cut -f 1,3 file
  liubi 14000

3.用法:cut -d:
    -d:表示使用:来作为分隔符号

    cut -d: -f 1 /etc/passwd > /tmp/users
    -------- /etc/passwd----------
    root:x:0:0:root:/root:/bin/bash
    ---------/tmp/users-----------
    root

4.用法:
阅读(230) | 评论(0) | 转发(0) |
0

上一篇:commands: dialog

下一篇:commands: paste

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