当前位置: 首页 > 图文教程 > 操作系统 > Unix/Linux > Linux 指令篇:档案目录管理--cut

Unix/Linux
samba的配置[转载]
内核上的dns服务应答可以工作了
a bug of ng_vlan?
安装discuz论坛过程中出现不能识别preg_replace()函数的问题!
DHCP配置
一个很简单但是最常用的SED例子:UNIXDOS文本格式转换
在 linux 上架设 FreeBSD CVSup mirror
CICS FOR WINDOWS
FreeBSD光盘运行版的制作过程
初识FreeBSD
自定义C shell
Linux真的比Windows安全?
ipf+ipnat+ipfw建立带流量控制的透明网关
8139C+ 不能被正确识别网线状态的修订
Reinstall the boot manager.
备份qmail的一个脚本
Open the sound volume
FreeBSD-5.2下安装ORACLE9i手记
bsd 分支表
DNS傻瓜书

Unix/Linux 中的 Linux 指令篇:档案目录管理--cut


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-11-01   浏览: 159 ::
收藏到网摘: n/a

  名称:cut

使用权限:所有使用者

用法:cut -cnum1-num2 filename

说明:显示每行从开头算起 num1 到 num2 的文字。

范例:

        shell>> cat example
        test2
        this is test1
        shell>> cut -c0-6 example       ## print 开头算起前 6 个字元
        test2
        this i 

 cut其实很有用
-c m-n 表示显示每一行的第m个字元到第n个字元。例如:

 ---------file----------- 
  liubi  23 14000 
---------file----------- 
# cut -c 3-9,12-20 file 
liubi 14000  
 
-f m-n 表示显示第m栏到第n栏(使用tab分隔)。例如: 
 ---------file----------- 
liubi  23  14000 
---------file----------- 
# cut -f 1,3 file 
liubi 14000