cut用法
cut命令用来剪下文本文件里的数据,文本文件可以是字段类型或是字符类型。
cut - remove sections from each line of files
语法
cut OPTION... [FILE]...
选项
-b --bytes=list #select only these bytes
-c --characters=list #select only these characters #以字符为主,执行剪下的操作。list为字符编号或一段范围的列表(以逗号分割),如1,3,5-12,42。
-d --delimiter=DELIM #use DELIM instead of TAB for filed delimiter
-f --fields=list #select only these fields; also print any line that contains no delimiter character, unless the -s option is specified. #以字段为主操作。list为字段编号或一段范围的列表(以逗号分割)。
-s --only-delimited #do not print lines not containing delimiters.
行为模式
剪下输入字符中指定的字段或指定的范围。若处理的是字段,则定界符隔开的即为各字段,而输出时字段也以给定的定界符隔开。
举例
cut -d : -f 1,5 /etc/passwd #取出字段
cut -d : -f 1,6 /etc/passwd #取出根目录
注:POSIX系统下,cut识别多字节字符。因此,“字符character”与“字节byte”意义不同。
有些系统对输入行的大小有限制,尤其是含有多字节字符时。
cut用法的更多相关文章
- shell中cut用法
cut是一个选取命令,就是将一段数据经过分析,取出我们想要的.一般来说,选取信息通常是针对“行”来进行分析的,并不是整篇信息分析的. (1)其语法格式为:cut [-bn] [file] 或 cut ...
- linux之cut用法
转载:http://www.cnblogs.com/dong008259/archive/2011/12/09/2282679.html cut是一个选取命令,就是将一段数据经过分析,取出我们想要的. ...
- linux截取字符串之sort、uniq、cut用法
sort命令是帮我们依据不同的数据类型进行排序 参 数: -b 忽略每行前面开始出的空格字符. -c 检查文件是否已经按照顺序排序. -f 排序时,忽略大小写字母. -M 将前 ...
- linux之cut用法--转载
cut是一个选取命令,就是将一段数据经过分析,取出我们想要的.一般来说,选取信息通常是针对“行”来进行分析的,并不是整篇信息分析的. (1)其语法格式为:cut [-bn] [file] 或 cut ...
- shell cut 用法
cut -f 提取第几列 -d 按指定的分隔符割列 cut -f 1 xxx.txt 提取第1列 cut -f 1,3 xxx.txt 提取第1,3列 cut -d ":&qu ...
- Linux cut 用法
cut是一个选取命令,就是将一段数据经过分析,取出我们想要的.一般来说,选取信息通常是针对"行"来进行分析的,并不是整篇信息分析的. )其语法格式为:cut [-bn] [fil ...
- linux cut的用法
p.p1 { margin: 0; font: 12px ".PingFang SC Semibold"; color: rgba(53, 53, 53, 1) } p.p2 { ...
- linux head、tail、sed、cut、grep、find
head用法: head 参数 文件名 -cn:显示前n个字节 -n:显示前n行 例子:head -c20 1.txt 显示1.txt文件中前20个字符 ls | head -20:显示前20 ...
- 《sed的流艺术之一》-linux命令五分钟系列之二十一
本原创文章属于<Linux大棚>博客,博客地址为http://roclinux.cn.文章作者为rocrocket. 为了防止某些网站的恶性转载,特在每篇文章前加入此信息,还望读者体谅. ...
随机推荐
- jQuery的封装和扩展方式
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title> ...
- HTTP请求头详解
http://blog.csdn.net/kfanning/article/details/6062118 HTTP由两部分组成:请求和响应.当你在Web浏览器中输入一个URL时,浏览 器将根据你的要 ...
- 解决clang: error: no such file or directory: such file or directory:的问题
一,详细问题描述 clang: error: no such file or directory: 'xxx/src/GGBaCollectionViewCell.m' clang: error: n ...
- C#注意事项及错误处理
1 使用到config文件配置数据库路径 ConfigurationManager.ConnectionStrings["dbPath"].ConnectionString; db ...
- Highcharts用函数动态填充静态值
这种方式适用于其他动态函数模式 series: [{ name: 'Random data', data: (function() { // generate an array of random d ...
- [LintCode] Continuous Subarray Sum 连续子数组之和
Given an integer array, find a continuous subarray where the sum of numbers is the biggest. Your cod ...
- [LintCode] Sort Integers II 整数排序之二
Given an integer array, sort it in ascending order. Use quick sort, merge sort, heap sort or any O(n ...
- CentOS7配置双网卡绑定
配置team0配置文件: [root@CentOS7 ~]# cat /etc/sysconfig/network-scripts/ifcfg-team0DEVICE=team0DEVICETYPE= ...
- [转] - MC、MC、MCMC简述
贝叶斯集锦(3):从MC.MC到MCMC 2013-07-31 23:03:39 #####一份草稿 贝叶斯计算基础 一.从MC.MC到MCMC 斯坦福统计学教授Persi Diaconis是一位传奇 ...
- .offsetLeft,.offsetTop
*{ margin:0; padding:0} div {padding: 40px 50px;} #div1 {background: red;} #div2 {background: green; ...