cut
Print selected parts of lines from each FILE to standard output列举每行被选中的部分到标准输出,也就是提取行中的某个字段 【SYNOPSIS】 cut OPTION... [FILE]... 【OPTION】 -b,--bytes=LIST select only these bytes按字节分隔 -c,--characters=LIST select only these characters按字符分隔 -d,--delimiter=DELIM use DELIM instead of TAB for field delimiter 用TAB替换指定的分隔符来分区域 -f,--field=LIST 分区域后,根据区域位数来列出数据 -n with -b: don't split multibyte characters不分隔多字节字符 【FOR EXAMPLE】 [root@localhost ~]# cat /etc/passwd|cut -d: -f1 root bin daemon adm lp 提取/etc/passwd文件的第一个字段内容,也就是用户名 [root@localhost ~]# cat /tmp/ah2.txt |cut -nb 1,2,3 平凡的 [root@localhost ~]# cat /tmp/ah2.txt |cut -nb 1不分割字节 平 [root@localhost ~]# cat /tmp/ah2.txt |cut -b 1汉字属于多字节字符 [root@localhost ~]# cat /tmp/ah2.txt |cut -c 1 平
sort
sort lines of text files文本文件的行排序
【SYNOPSIS】
sort [OPTION]... [FILE]...
sort [OPTION]... --files0-from=F
【OPTION】
-b,--ignore-leading-blanks
-f,--ignore-case
fold lower case to upper case characters 忽略大小写
-i,--ignore-nonprinting
consider only printable characters忽略空白
-M,--month-sort
按照三位数月份排序
-h,--human-numeric-sort compare human readable numbers
使用人类可读的单位排序
-g,--genaral-numeric-sort
使用通用数值排序,支持科学计数
-t,--field-separator=SEP
use SEP instead of non-blank to blank transition
指定分列的分隔符
-k,--key=KEYDEF
sort via a key;KEYDEF gives location and type
指定列排序,
-n,--numeric-sort
compare according to string numerical value
根据字符串中的数值排序
-r,--reverse
反序排列
-c,--check check from srot input;don't sort
排序检查,但不排序
-o,--output=FILE write result to FILE instead of standard output
将结果保存至文件中而不输出
-u,--unique with -c,check for strict ordering; without -c,output only the first of an equal run
与-c组合,执行严格的顺序检查;不与-c组合,仅输出第一个结果,剔除相邻重复的行,重复且相邻的无法剔除。
uniq
report or omit repeated lines记录或剔除重复行
【SYNOPSIS】
uniq [OPTION]... [INPUT [OUTPUT]]
【OPTION】
-c,--count prefix lines by the number of occurrences行计数(重复行列一行,前面有重复次数)
-d,--repeated only print duplicate lines, one for each group只打印有重复的行
-D,--all-repeated[=METHOD]
-f,--skip-fields=N
跳过前N个字段
-s,--skip-chars=N
跳过前几个字符
-i,--ignore-case 忽略大小写
-u,--unique only print unique lines仅打印不重复的行
-z,--zero-terminated end lines with 0 bytes,not newline
-w,--check-chars=N compare no more than N characters in lines
第N个字符之后不做匹配








