- 1、本文档共24页,可阅读全部内容。
- 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
- 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
cut命令用法大全【DOC精选】
linux中截取字符串cut命令用法简介:
语法:cut -cnum1-num2 fileName
使用权限:所有使用者
说明:显示每行从开头算起 num1 到 num2 的文字。
例子:
shell cat fileName
test2
this is a test content
shell cut -c1-6 fileName ## print 开头算起前 6 个字元
test2
this i
-c m-n 表示显示每一行的第m个字元到第n个字元。例如:
liubi 23 140004
# cut -c 1-5,10-14 file
liubi
-f m-n 表示显示第m栏到第n栏(使用tab分隔)。例如:
liubi 23 14000
# cut -f 1,3 file
liubi 14000
-c 和 -f 参数可以跟以下子参数:
m 第m个字符或字段
m- 从第m个字符或字段到文件结束
-n 从第1个到第n个字符或字段
m-n 从第m个到第n个字符或字段
我们经常会遇到需要取出分字段的文件的某些特定字段,例如 /etc/password就是通过:分隔各个字段的。可以通过cut命令来实现。例如,我们希望将系统账号名保存到特定的文件,就可以:
cut -d: -f 1 /etc/passwd /tmp/users
-d用来定义分隔符,默认为tab键,-f表示需要取得哪个字段
如:
使用|分隔
cut -d’|’ -f2 1.test2.test
使用:分隔
cut -d’:’ -f2 1.test2.test
这里使用单引号或双引号都行。
/var/tmp/easypbx/
|-- etc
| `-- asterisk
|-- usr
| |-- include
| | |-- asterisk
| | | |-- _private.h
| | | |-- abstract_jb.h
| | | |-- acl.h
| | | |-- adsi.h
| | | |-- ael_structs.h
| | | |-- agi.h
| | | |-- alaw.h
| | | |-- aoc.h
| | | |-- app.h
| | | |-- ast_expr.h
| | | |-- ast_version.h
| | | |-- astdb.h
| | | |-- astmm.h
| | | |-- astobj.h
| | | |-- astobj2.h
| | | |-- astosp.h
| | | |-- audiohook.h
| | | |-- autochan.h
| | | |-- autoconfig.h
| | | |-- bridging.h
| | | |-- bridging_features.h
| | | |-- bridging_technology.h
| | | |-- build.h
| | | |-- buildinfo.h
| | | |-- buildopts.h
| | | |-- calendar.h
| | | |-- callerid.h
| | | |-- causes.h
| | | |-- ccss.h
| | | |-- cdr.h
| | | |-- cel.h
| | | |-- celt.h
| | | |-- channel.h
| | | |-- channelstate.h
| | | |-- chanvars.h
| | | |-- cli.h
| | | |-- compat.h
| | | |-- compiler.h
| | | |-- config.h
| | | |-- crypto.h
| | | |-- data.h
| | | |-- datastore.h
| | | |-- devicestate.h
| | | |-- dial.h
| | | |-- dlinkedlists.h
| | | |-- dns.h
| | | |-- dnsmg
您可能关注的文档
- CSS盒子模型【DOC精选】.doc
- CTO下载-数据库系统工程师考试大纲(新版)【DOC精选】.doc
- CTO下载-c语言编写俄罗斯方块【DOC精选】.doc
- cubase词典【DOC精选】.doc
- CTEX里的函数【DOC精选】.docx
- cut the rope【DOC精选】.doc
- cisco list【DOC精选】.doc
- Cutdew日语 拟声拟态词 总结【DOC精选】.doc
- CT系列永磁筒式磁选机【DOC精选】.doc
- cutomer service translation【DOC精选】.doc
- DB44_T 2611-2025 城市排水管网有毒有害气体监测与风险分级管理技术标准.pdf
- DB44_T 2612-2025 竞赛类科普活动策划与实施服务规范.pdf
- DB43_T 2947-2024 烟草种子质量控制规程.pdf
- DB37_T 4836-2025 煤矿风量实时监测技术要求.pdf
- 叉车防撞系统,全球前22强生产商排名及市场份额(by QYResearch).docx
- 超滤膜,全球前18强生产商排名及市场份额(by QYResearch).docx
- DB62T 4172-2020 玉米品种 酒623规范.pdf
- DB62T 4160-2020 在用真空绝热深冷压力容器综合性能在线检测方法.pdf
- DB62T 4164-2020 辣椒品种 酒椒1号.pdf
- DB62T 4133-2020 公路隧道地质超前预报机械能无损探测技术规程.pdf
文档评论(0)