---- GREP(1)
NAME:grep - Search for PATTERN in each FILE or standard input.
PATTERN is, by default, a basic regular expression (BRE) 正则表达式
选项说明:
-n,--line-number : print line number with output files
-s,--no-messages : suppress error messages. 不显示错误信息
-v, --invert-match : select non-matching lines 取反操作,选择不匹配的输出。
-A,--after-context=NUM : print NUM lines of trailing context 输出context后的NUM行
-B,--before-context=NUM : print NUM lines of leading context
-C,--context=NUM : print NUM lines of output context,上下NUM行都输出
-NUM same as --context=NUM
命令cut用于基于列处理文本
-d,--delimiter 指定分割字符,默认是Tab
-f,--fields 指定输出的列号,某一行的域
-c,--character 基于字符进行分割
-d:表示以:作为分隔符。
-c3-10表示显示第3~10个字符。
[yanxia.dong@eslruntime07 exercise]$ grep -n yanxia.dong /etc/passwd 54:yanxia.dong:x:508:100::/home/yanxia.dong:/bin/bash [yanxia.dong@eslruntime07 exercise]$ grep -n -A3 yanxia.dong /etc/passwd 54:yanxia.dong:x:508:100::/home/yanxia.dong:/bin/bash 55-hailong.yu:x:509:100::/home/hailong.yu:/bin/tcsh 56-zezeng.feng:x:510:100::/home/zezeng.feng:/bin/bash 57-eslshare:x:511:100::/home/eslshare:/sbin/nologin [yanxia.dong@eslruntime07 exercise]$ grep -n -B3 yanxia.dong /etc/passwd 51-feifan.wang:x:505:100::/home/feifan.wang:/bin/bash 52-tao.gao:x:506:100::/home/tao.gao:/bin/csh 53-mengjiao.liu:x:507:100::/home/mengjiao.liu:/bin/bash 54:yanxia.dong:x:508:100::/home/yanxia.dong:/bin/bash [yanxia.dong@eslruntime07 exercise]$ grep -n -C3 yanxia.dong /etc/passwd 51-feifan.wang:x:505:100::/home/feifan.wang:/bin/bash 52-tao.gao:x:506:100::/home/tao.gao:/bin/csh 53-mengjiao.liu:x:507:100::/home/mengjiao.liu:/bin/bash 54:yanxia.dong:x:508:100::/home/yanxia.dong:/bin/bash 55-hailong.yu:x:509:100::/home/hailong.yu:/bin/tcsh 56-zezeng.feng:x:510:100::/home/zezeng.feng:/bin/bash 57-eslshare:x:511:100::/home/eslshare:/sbin/nologin [yanxia.dong@eslruntime07 exercise]$ grep -n -1 yanxia.dong /etc/passwd 53-mengjiao.liu:x:507:100::/home/mengjiao.liu:/bin/bash 54:yanxia.dong:x:508:100::/home/yanxia.dong:/bin/bash 55-hailong.yu:x:509:100::/home/hailong.yu:/bin/tcsh
---- DIFF(1)
NAME:diff - compare files line by line
OPTION:
-i --ignore-case : Ignore case differences in file contents.
-E --ignore-tab-expansion : Ignore changes due to tab expansion. 忽略Tab键引起的变化
-b --ignore-space-change : Ignore changes in the amount of the white space. 忽略空格数量的变化
-w --ignore-all-space : Ignore all white space.忽略所有的空白
-B --ignore-blank-lines : Ignore changes whose lines are all blank. 忽略空白行
-c -C NUM --context [=NUM] : Output NUM (default 3) lines of copied context.
-u -U NUM --unified [=NUM] : Output NUM (default 3) lines of unified context. 统一显示比较信息