grep

搜文本文件.

语法

  grep [options] PATTERN [FILE...]

  grep [options] [-e PATTERN | -f FILE] [FILE...]

一个简单的例子:

$ grep "hello word" /etc/*

选项



   -A NUM
   --after-context=NUM
       除了显示符合范本样式的那一行之外,并显示该行之后的内容
   -a
   --text
      不忽略二进制数据

   -B NUM
   --before-context=NUM
       除了显示符合范本样式的那一列之外,并显示该列之前的内容
   -b
   --byte-offset
       在显示符合范本样式的那一列之前,标示出该列第一个字符的位编号
   --binary-files=TYPE
       如果文件的前几个字节表明该文件包含二进制数据,则假定 
       该文件的类型为TYPE。默认情况下,TYPE是二进制,grep通常输出
       要么说二进制文件匹配的单行消息,要么就是没有消息
       不配。如果TYPE不匹配,则grep假定二进制文件不匹配;
       这相当于-I选项。如果TYPE是文本,则grep将二进制文件处理为
       如果是文字; 这相当于-a选项。
   --colour[=WHEN]
   --color[=WHEN]
       使用GREP_COLOR环境变量中的标记匹配的字符串。
       可以是'never','always'或'auto',例如--color = always 
       默认情况下,匹配的文本将显示为红色。
       如果使grep匹配多个字符串,则所有匹配都将着色,一个例外
       是正则表达式^(匹配每一行的开头),一行的开头没有长度所以会不着色。
       所以返回所有的行和颜色只匹配: egrep --color=always '^|string1|string2'

   -C NUM
   --context=NUM
         除了显示符合范本样式的那一列之外,并显示该列之前后的内容 
   -c
   --count
        计算符合范本样式的列数

   -D ACTION
   --devices=ACTION
       如果输入文件是设备,FIFO或套接字,请使用ACTION处理它。
       默认情况下,会读取ACTION,这意味着设备的读取就像它们一样
       普通文件。如果跳过ACTION,则会跳过设备。
   -d ACTION
   --directories=ACTION
       如果输入文件是目录,请使用ACTION处理它。
       默认情况下,读取ACTION,这意味着读取目录就像它们一样
       是普通文件。如果跳过ACTION,则会跳过目录。
       如果ACTION是递归的,grep会递归地读取每个目录下的所有文件; 这个
       相当于-r选项
   -E
   --extended-regexp
       扩展为正则表达式

   -e PATTERN
   --regexp=PATTERN
       指定字符串做为查找文件内容的范本样式 -.

   -F
   --fixed-strings
       将范本样式视为固定字符串的列表。

   -f FILE
   --file=FILE
        指定范本文件,其内容含有一个或多个范本样式,让grep查找符合范本条件的文件内容,格式为每列一个范本样式。

   -G
   --basic-regexp
       将范本样式视为普通的表示法来使用
 
   -H
   --with-filename
       在显示符合范本样式的那一列之前,表示该列所属的文件名称
   -h
   --no-filename
       在显示符合范本样式的那一列之前,不标示该列所属的文件名称。
   --help
      输出简短的帮助信息。

   -I
      处理二进制文件,就好像它不包含匹配数据一样; 这是
      相当于--binary-files =不匹配选项.
   -i
   --ignore-case
      忽略字符大小写的差别

   -L
   --files-without-match
      列出文件内容符合指定的范本样式的文件名称
   -l
   --files-with-matches
      列出文件内容不符合指定的范本样式的文件名称

   -m NUM
   --max-count=NUM
      NUM匹配行后停止读取文件。
      如果输入是常规文件的标准输入,则NUM匹配行
      输出,grep确保标准输入位于最后一个之后
      退出前匹配行,无论是否存在尾随上下文行。
      这使呼叫过程能够恢复搜索。当NUM匹配后grep停止时
      行,它输出任何尾随上下文行。
      如果还使用-c或--count选项,则grep不会输出更大的计数
      比NUM。当还使用-v或--invert-match选项时,grep会在之后停止
      输出NUM个不匹配的行。
   --mmap
      如果可能,使用mmap(2)系统调用来读取输入,而不是默认值
      读(2)系统调用。在某些情况下, - mmap会产生更好的性能。
      但是,如果输入, - mmap可能导致未定义的行为(包括核心转储)
      grep正在运行时,或者如果发生I/O错误,文件会收缩。
   -n
   --line-number
     使用输入文件中的行号为每行输出添加前缀

   -o
   --only-matching
      只输出文件中匹配到的部分

   --label=LABEL
      显示输入实际来自标准输入,作为来自文件LABEL的输入。
       这对于像zgrep这样的工具特别有用,例如 gzip -cd foo.gz |grep --label=foo something 

   --line-buffered
      使用行缓冲,它可以是性能压力

   -P
   --perl-regexp
       解释为正则表达式

   -q
   --quiet, --silent
       不在标准输出上写任何东西
   -R
   -r
   --recursive
       递归读取每个目录下的所有文件; 这相当于'-d recurse'选项。
       并非所有grep实现都支持-r,并且在这些实现中,链接的行为可能不同

   --include=PATTERN
       在仅搜索匹配文件的目录中递归
   --exclude=PATTERN
       目录中的递归跳过文件匹配模式.
 
   -s
   --no-messages
       不显示错误信息

   -U, --binary
       将文件视为二进制文件
   -u
   --unix-byte-offsets
        报告Unix样式的字节偏移

   -V
   --version
       将grep的版本号打印到标准错误
   -v
   --invert-match
       反转匹配,选择不匹配的行
   -w
   --word-regexp
       仅选择包含构成整个单词的匹配项的行

   -x
   --line-regexp
       仅选择与整行完全匹配的匹配项。
   -y
      此参数效果跟“-i”相同
   -Z
   --null
       输出零字节(ASCII NUL字符),而不是
       通常在文件名后面的字符


环境变量
设置以下环境变量可能会影响Grep的行为

GREP_OPTIONS                 -  默认选项
GREP_COLOR                   -  突出显示
LC_ALL, LC_COLLATE, LANG     - 这些变量指定LC_COLLATE语言环境,
                               该语言环境确定用于
                               解释范围表达式(如[az])的整理顺序. 
LC_ALL, LC_COLLATE, LANG
    这些变量指定LC_MESSAGES语言环境,该
    语言环境确定用于消息的语言。默认的C语言环境使用美国英语消息。. 
LC_ALL, LC_CTYPE, LANG       -  指定LC_CTYPE语言环境,它确定
                               字符的类型,例如,哪些字符是空格。
LC_ALL, LC_MESSAGES, LANG
    这些变量指定LC_MESSAGES语言环境,该
    语言环境确定grep用于消息的语言。默认的C语言环境使用美国英语消息。
POSIXLY_CORRECT              - Posix behaviour
_N_GNU_nonoption_argv_flags_
    如果此环境变量值的第i个字符为1,则不
    要将grep的第i个操作数视为一个选项,(N是grep的数字进程ID)

grep以下列值之一:

0     选择了一行或多行.
1     未选择任何行
>1    语法错误,无法访问的输入文件或其他系统错误

换句话说,未能找到匹配的项目被报告为错误(1)

实例

搜索文件example.txt,包括字符串’hunting the snark’的二进制数据(-a:

$ sudo grep -a 'hunting the snark' example.txt

搜索整个分区(/sda1),包括二进制数据(-a)为字符串’'hunting the snark’返回所有行,从文本的25前和找到50行后到匹配文本。
这可以是一种发现已删除文件片段的方法,但速度很慢:

$ grep -a -B 25 -A 50 'hunting the snark' /dev/sda1 > results.txt

在文件wordlist.txt中搜索不包含至少一个元音的行:

$ grep -v [aeiou] wordlist.txt

如果它们出现在paid.txt中,则从invoices.txt中删除行:

 $ grep -F -x -v -f paid.txt invoices.txt >paidinvoices.txt

grep 命令实例:

linux命令:grep -H '^psk=' /etc/NetworkManager/system-connections/* /etc/NetworkManager/system-connections/* '^psk=' -H grep grep -H '^psk=' /etc/NetworkManager/system-connections/*rootopen.com
linux命令:grep -H '^psk=' /etc/NetworkManager/system-connections/* /etc/NetworkManager/system-connections/* '^psk=' -H grep grep -H '^psk=' /etc/NetworkManager/system-connections/*rootopen.com
2019-07-09 20:58:53

linux命令:grep -i 'DocumentRoot' /usr/local/apache/conf/httpd.conf /usr/local/apache/conf/httpd.conf 'DocumentRoot' -i grep grep -i 'DocumentRoot' /usr/local/apache/conf/httpd.confrootopen.com
linux命令:grep -i 'DocumentRoot' /usr/local/apache/conf/httpd.conf /usr/local/apache/conf/httpd.conf 'DocumentRoot' -i grep grep -i 'DocumentRoot' /usr/local/apache/conf/httpd.confrootopen.com
2019-06-17 23:17:09

linux命令:grep -v $'[^\t\r -~]' my-file-with-non-ascii-characters my-file-with-non-ascii-characters -~]' $'[^\t\r -v grep grep -v $'[^\t\r -~]' my-file-with-non-ascii-charactersrootopen.com
linux命令:grep -v $'[^\t\r -~]' my-file-with-non-ascii-characters my-file-with-non-ascii-characters -~]' $'[^\t\r -v grep grep -v $'[^\t\r -~]' my-file-with-non-ascii-charactersrootopen.com
2019-06-05 22:26:10

linux命令:grep -vE '^\s*(#|$)' textfile textfile '^\s*(#|$)' -vE grep grep -vE '^\s*(#|$)' textfilerootopen.com
linux命令:grep -vE '^\s*(#|$)' textfile textfile '^\s*(#|$)' -vE grep grep -vE '^\s*(#|$)' textfilerootopen.com
2019-03-23 19:14:20

linux命令:grep -v $'[^\t\r -~]' my-file-with-non-ascii-characters my-file-with-non-ascii-characters -~]' $'[^\t\r -v grep grep -v $'[^\t\r -~]' my-file-with-non-ascii-charactersrootopen.com
linux命令:grep -v $'[^\t\r -~]' my-file-with-non-ascii-characters my-file-with-non-ascii-characters -~]' $'[^\t\r -v grep grep -v $'[^\t\r -~]' my-file-with-non-ascii-charactersrootopen.com
2019-03-23 18:53:01

linux命令:grep -n ^ /path/to/file | less less | /path/to/file ^ -n grep grep -n ^ /path/to/file | lessrootopen.com
linux命令:grep -n ^ /path/to/file | less less | /path/to/file ^ -n grep grep -n ^ /path/to/file | lessrootopen.com
2019-01-06 22:21:52

linux命令:grep -vxFf file1 file2 file2 file1 -vxFf grep grep -vxFf file1 file2rootopen.com
linux命令:grep -vxFf file1 file2 file2 file1 -vxFf grep grep -vxFf file1 file2rootopen.com
2019-01-06 22:17:58

linux命令:grep -n ^ /path/to/file | less less | /path/to/file ^ -n grep grep -n ^ /path/to/file | lessrootopen.com
linux命令:grep -n ^ /path/to/file | less less | /path/to/file ^ -n grep grep -n ^ /path/to/file | lessrootopen.com
2018-12-08 17:04:07

linux命令:grep --color -E 'highlight|' file file 'highlight|' -E --color grep grep --color -E 'highlight|' file rootopen.com
linux命令:grep --color -E 'highlight|' file file 'highlight|' -E --color grep grep --color -E 'highlight|' file rootopen.com
2018-12-02 21:20:48

linux命令:grep -vxFf ItemsListtoAvoid.txt AllItemsList.txt> ItemsDifference.txt ItemsDifference.txt AllItemsList.txt> ItemsListtoAvoid.txt -vxFf grep grep -vxFf ItemsListtoAvoid.txt AllItemsList.txt> ItemsDifference.txtrootopen.com
linux命令:grep -vxFf ItemsListtoAvoid.txt AllItemsList.txt> ItemsDifference.txt ItemsDifference.txt AllItemsList.txt> ItemsListtoAvoid.txt -vxFf grep grep -vxFf ItemsListtoAvoid.txt AllItemsList.txt> ItemsDifference.txtrootopen.com
2018-11-02 23:15:39

linux命令:grep -E -E grep grep -Erootopen.com
linux命令:grep -E -E grep grep -Erootopen.com
2018-09-11 09:55:30

linux命令:grep –v “#” /etc/apache2/sites-available/default-ssl /etc/apache2/sites-available/default-ssl “#” –v grep grep –v “#” /etc/apache2/sites-available/default-sslrootopen.com
linux命令:grep –v “#” /etc/apache2/sites-available/default-ssl /etc/apache2/sites-available/default-ssl “#” –v grep grep –v “#” /etc/apache2/sites-available/default-sslrootopen.com
2018-09-11 09:55:30

linux命令:grep ‘tecmint’ domain-list.txt domain-list.txt ‘tecmint’ grep grep ‘tecmint’ domain-list.txtrootopen.com
linux命令:grep ‘tecmint’ domain-list.txt domain-list.txt ‘tecmint’ grep grep ‘tecmint’ domain-list.txtrootopen.com
2018-09-11 09:55:30

linux命令:grep -i 'hello' * * 'hello' -i grep grep -i 'hello' *rootopen.com
linux命令:grep -i 'hello' * * 'hello' -i grep grep -i 'hello' *rootopen.com
2018-08-11 22:23:42

linux命令:grep -r 'hello' * * 'hello' -r grep grep -r 'hello' *rootopen.com
linux命令:grep -r 'hello' * * 'hello' -r grep grep -r 'hello' *rootopen.com
2018-08-11 22:21:36

linux命令:grep 'hello' * * 'hello' grep grep 'hello' *rootopen.com
linux命令:grep 'hello' * * 'hello' grep grep 'hello' *rootopen.com
2018-08-11 22:19:13

linux命令:grep 'hello word' file1 file2 file3 file3 file2 file1 word' 'hello grep grep 'hello word' file1 file2 file3rootopen.com
linux命令:grep 'hello word' file1 file2 file3 file3 file2 file1 word' 'hello grep grep 'hello word' file1 file2 file3rootopen.com
2018-08-11 22:17:40

linux命令:grep hello file1 file2 file3 file3 file2 file1 hello grep grep hello file1 file2 file3rootopen.com
linux命令:grep hello file1 file2 file3 file3 file2 file1 hello grep grep hello file1 file2 file3rootopen.com
2018-08-11 22:15:14

linux命令:grep -o "\(new \(\w\+\)\|\w\+::\)" file.php | sed 's/new \|:://' | sort | uniq -c | sort sort | -c uniq | sort | \|:://' 's/new sed | file.php \(\w\+\)\|\w\+::\)" "\(new -o grep grep -o "\(new \(\w\+\)\|\w\+::\)" file.php | sed 's/new \|:://' | sort | uniq -c | sortrootopen.com
linux命令:grep -o "\(new \(\w\+\)\|\w\+::\)" file.php | sed 's/new \|:://' | sort | uniq -c | sort sort | -c uniq | sort | \|:://' 's/new sed | file.php \(\w\+\)\|\w\+::\)" "\(new -o grep grep -o "\(new \(\w\+\)\|\w\+::\)" file.php | sed 's/new \|:://' | sort | uniq -c | sortrootopen.com
2018-02-15 10:28:48

linux命令:grep -v "^#" file.txt | more more | file.txt "^#" -v grep grep -v "^#" file.txt | morerootopen.com
linux命令:grep -v "^#" file.txt | more more | file.txt "^#" -v grep grep -v "^#" file.txt | morerootopen.com
2018-04-04 10:25:48

linux命令:grep -r "sampleString" . |uniq | cut -d: -f1 | xargs sed -i "/sampleString/d" "/sampleString/d" -i sed xargs | -f1 -d: cut | |uniq . "sampleString" -r grep grep -r "sampleString" . |uniq | cut -d: -f1 | xargs sed -i "/sampleString/d"rootopen.com
linux命令:grep -r "sampleString" . |uniq | cut -d: -f1 | xargs sed -i "/sampleString/d" "/sampleString/d" -i sed xargs | -f1 -d: cut | |uniq . "sampleString" -r grep grep -r "sampleString" . |uniq | cut -d: -f1 | xargs sed -i "/sampleString/d"rootopen.com
2018-02-18 09:25:48

linux命令:grep -lir "text to find" * * find" to "text -lir grep grep -lir "text to find" *rootopen.com
linux命令:grep -lir "text to find" * * find" to "text -lir grep grep -lir "text to find" *rootopen.com
2018-04-21 12:21:48

linux命令:grep -r -l xxxxx . | xargs perl -i -pe "s/xxxxx/yyyyy/g" "s/xxxxx/yyyyy/g" -pe -i perl xargs | . xxxxx -l -r grep grep -r -l xxxxx . | xargs perl -i -pe "s/xxxxx/yyyyy/g"rootopen.com
linux命令:grep -r -l xxxxx . | xargs perl -i -pe "s/xxxxx/yyyyy/g" "s/xxxxx/yyyyy/g" -pe -i perl xargs | . xxxxx -l -r grep grep -r -l xxxxx . | xargs perl -i -pe "s/xxxxx/yyyyy/g"rootopen.com
2018-05-19 13:13:48

linux命令:grep -v "^\($\|#\)" <filenames> <filenames> "^\($\|#\)" -v grep grep -v "^\($\|#\)" <filenames>rootopen.com
linux命令:grep -v "^\($\|#\)" <filenames> <filenames> "^\($\|#\)" -v grep grep -v "^\($\|#\)" <filenames>rootopen.com
2018-05-08 23:13:48

linux命令:grep -sq "" /etc/lsb-release && lsb_release -rd -rd lsb_release && /etc/lsb-release "" -sq grep grep -sq "" /etc/lsb-release && lsb_release -rdrootopen.com
linux命令:grep -sq "" /etc/lsb-release && lsb_release -rd -rd lsb_release && /etc/lsb-release "" -sq grep grep -sq "" /etc/lsb-release && lsb_release -rdrootopen.com
2018-01-01 05:20:48

linux命令:grep "processor" /proc/cpuinfo | wc -l -l wc | /proc/cpuinfo "processor" grep grep "processor" /proc/cpuinfo | wc -lrootopen.com
linux命令:grep "processor" /proc/cpuinfo | wc -l -l wc | /proc/cpuinfo "processor" grep grep "processor" /proc/cpuinfo | wc -lrootopen.com
2017-12-27 07:28:48

linux命令:grep -c -e '^cpu[0-9]\+' /proc/stat /proc/stat '^cpu[0-9]\+' -e -c grep grep -c -e '^cpu[0-9]\+' /proc/statrootopen.com
linux命令:grep -c -e '^cpu[0-9]\+' /proc/stat /proc/stat '^cpu[0-9]\+' -e -c grep grep -c -e '^cpu[0-9]\+' /proc/statrootopen.com
2018-03-17 01:46:48

linux命令:grep -iR find_me ./ ./ find_me -iR grep grep -iR find_me ./rootopen.com
linux命令:grep -iR find_me ./ ./ find_me -iR grep grep -iR find_me ./rootopen.com
2018-05-16 00:06:48

linux命令:grep -v "^$" file file "^$" -v grep grep -v "^$" filerootopen.com
linux命令:grep -v "^$" file file "^$" -v grep grep -v "^$" filerootopen.com
2018-04-06 03:02:48

linux命令:grep lm /proc/cpuinfo /proc/cpuinfo lm grep grep lm /proc/cpuinforootopen.com
linux命令:grep lm /proc/cpuinfo /proc/cpuinfo lm grep grep lm /proc/cpuinforootopen.com
2018-02-17 05:35:48

linux命令:grep --color=auto -iRnH "$search_word" $directory $directory "$search_word" -iRnH --color=auto grep grep --color=auto -iRnH "$search_word" $directoryrootopen.com
linux命令:grep --color=auto -iRnH "$search_word" $directory $directory "$search_word" -iRnH --color=auto grep grep --color=auto -iRnH "$search_word" $directoryrootopen.com
2017-12-25 07:12:48

linux命令:grep "FOUND" /var/log/squidclamav.log | awk '{print $5"-"$2"-"$3","$4","$11}' | sed -e 's/\,http.*url=/\,/g' | sed -e 's/&/\,/g' | sed -e 's/source=//g' |sed -e 's/user=//g' | sed -e 's/virus=//g' | sed -e 's/stream\:+//g' | sed -e 's/\+FOUND//g' 's/\+FOUND//g' -e sed | 's/stream\:+//g' -e sed | 's/virus=//g' -e sed | 's/user=//g' -e |sed 's/source=//g' -e sed | 's/&/\,/g' -e sed | 's/\,http.*url=/\,/g' -e sed | $5"-"$2"-"$3","$4","$11}' '{print awk | /var/log/squidclamav.log "FOUND" grep grep "FOUND" /var/log/squidclamav.log | awk '{print $5"-"$2"-"$3","$4","$11}' | sed -e 's/\,http.*url=/\,/g' | sed -e 's/&/\,/g' | sed -e 's/source=//g' |sed -e 's/user=//g' | sed -e 's/virus=//g' | sed -e 's/stream\:+//g' | sed -e 's/\+FOUND//g'rootopen.com
linux命令:grep "FOUND" /var/log/squidclamav.log | awk '{print $5"-"$2"-"$3","$4","$11}' | sed -e 's/\,http.*url=/\,/g' | sed -e 's/&/\,/g' | sed -e 's/source=//g' |sed -e 's/user=//g' | sed -e 's/virus=//g' | sed -e 's/stream\:+//g' | sed -e 's/\+FOUND//g' 's/\+FOUND//g' -e sed | 's/stream\:+//g' -e sed | 's/virus=//g' -e sed | 's/user=//g' -e |sed 's/source=//g' -e sed | 's/&/\,/g' -e sed | 's/\,http.*url=/\,/g' -e sed | $5"-"$2"-"$3","$4","$11}' '{print awk | /var/log/squidclamav.log "FOUND" grep grep "FOUND" /var/log/squidclamav.log | awk '{print $5"-"$2"-"$3","$4","$11}' | sed -e 's/\,http.*url=/\,/g' | sed -e 's/&/\,/g' | sed -e 's/source=//g' |sed -e 's/user=//g' | sed -e 's/virus=//g' | sed -e 's/stream\:+//g' | sed -e 's/\+FOUND//g'rootopen.com
2018-01-26 23:12:48

linux命令:grep -r --exclude-dir=.svn PATTERN PATH PATH PATTERN --exclude-dir=.svn -r grep grep -r --exclude-dir=.svn PATTERN PATHrootopen.com
linux命令:grep -r --exclude-dir=.svn PATTERN PATH PATH PATTERN --exclude-dir=.svn -r grep grep -r --exclude-dir=.svn PATTERN PATHrootopen.com
2018-05-05 00:37:48

linux命令:grep 'HOME.*' data.txt | awk '{print $2}' | awk '{FS="/"}{print $NF}' OR USE ALTERNATE WAY awk '/HOME/ {print $2}' data.txt | awk -F'/' '{print $NF}' $NF}' '{print -F'/' awk | data.txt $2}' {print '/HOME/ awk WAY ALTERNATE USE OR $NF}' '{FS="/"}{print awk | $2}' '{print awk | data.txt 'HOME.*' grep grep 'HOME.*' data.txt | awk '{print $2}' | awk '{FS="/"}{print $NF}' OR USE ALTERNATE WAY awk '/HOME/ {print $2}' data.txt | awk -F'/' '{print $NF}'rootopen.com
linux命令:grep 'HOME.*' data.txt | awk '{print $2}' | awk '{FS="/"}{print $NF}' OR USE ALTERNATE WAY awk '/HOME/ {print $2}' data.txt | awk -F'/' '{print $NF}' $NF}' '{print -F'/' awk | data.txt $2}' {print '/HOME/ awk WAY ALTERNATE USE OR $NF}' '{FS="/"}{print awk | $2}' '{print awk | data.txt 'HOME.*' grep grep 'HOME.*' data.txt | awk '{print $2}' | awk '{FS="/"}{print $NF}' OR USE ALTERNATE WAY awk '/HOME/ {print $2}' data.txt | awk -F'/' '{print $NF}'rootopen.com
2018-02-23 11:17:48

linux命令:grep Mar/2009 /var/log/apache2/access.log | awk '{ print $1 }' | sort -n | uniq -c | sort -rn | head head | -rn sort | -c uniq | -n sort | }' $1 print '{ awk | /var/log/apache2/access.log Mar/2009 grep grep Mar/2009 /var/log/apache2/access.log | awk '{ print $1 }' | sort -n | uniq -c | sort -rn | headrootopen.com
linux命令:grep Mar/2009 /var/log/apache2/access.log | awk '{ print $1 }' | sort -n | uniq -c | sort -rn | head head | -rn sort | -c uniq | -n sort | }' $1 print '{ awk | /var/log/apache2/access.log Mar/2009 grep grep Mar/2009 /var/log/apache2/access.log | awk '{ print $1 }' | sort -n | uniq -c | sort -rn | headrootopen.com
2018-03-21 18:21:48

linux命令:grep '' -m X file1 > file2 file2 > file1 X -m '' grep grep '' -m X file1 > file2rootopen.com
linux命令:grep '' -m X file1 > file2 file2 > file1 X -m '' grep grep '' -m X file1 > file2rootopen.com
2018-01-18 22:46:48

linux命令:grep "install " /var/log/dpkg.log | awk '{print $4}' | xargs apt-get -y remove --purge --purge remove -y apt-get xargs | $4}' '{print awk | /var/log/dpkg.log " "install grep grep "install " /var/log/dpkg.log | awk '{print $4}' | xargs apt-get -y remove --purgerootopen.com
linux命令:grep "install " /var/log/dpkg.log | awk '{print $4}' | xargs apt-get -y remove --purge --purge remove -y apt-get xargs | $4}' '{print awk | /var/log/dpkg.log " "install grep grep "install " /var/log/dpkg.log | awk '{print $4}' | xargs apt-get -y remove --purgerootopen.com
2017-12-29 02:51:48

linux命令:grep -r "mystring" . |uniq | cut -d: -f1 | xargs sed -i "s/mystring//" "s/mystring//" -i sed xargs | -f1 -d: cut | |uniq . "mystring" -r grep grep -r "mystring" . |uniq | cut -d: -f1 | xargs sed -i "s/mystring//"rootopen.com
linux命令:grep -r "mystring" . |uniq | cut -d: -f1 | xargs sed -i "s/mystring//" "s/mystring//" -i sed xargs | -f1 -d: cut | |uniq . "mystring" -r grep grep -r "mystring" . |uniq | cut -d: -f1 | xargs sed -i "s/mystring//"rootopen.com
2017-12-28 15:33:48

linux命令:grep -i --color=auto --color=auto -i grep grep -i --color=autorootopen.com
linux命令:grep -i --color=auto --color=auto -i grep grep -i --color=autorootopen.com
2018-06-05 16:13:48

linux命令:grep -i '<searchTerm>\|<someOtherSearchTerm>' <someFileName> <someFileName> '<searchTerm>\|<someOtherSearchTerm>' -i grep grep -i '<searchTerm>\|<someOtherSearchTerm>' <someFileName>rootopen.com
linux命令:grep -i '<searchTerm>\|<someOtherSearchTerm>' <someFileName> <someFileName> '<searchTerm>\|<someOtherSearchTerm>' -i grep grep -i '<searchTerm>\|<someOtherSearchTerm>' <someFileName>rootopen.com
2018-02-28 12:53:48

linux命令:grep -ao -HP "http://[^/]*/" * * "http://[^/]*/" -HP -ao grep grep -ao -HP "http://[^/]*/" *rootopen.com
linux命令:grep -ao -HP "http://[^/]*/" * * "http://[^/]*/" -HP -ao grep grep -ao -HP "http://[^/]*/" *rootopen.com
2018-05-07 05:29:48

linux命令:grep -lir "some text" * * text" "some -lir grep grep -lir "some text" *rootopen.com
linux命令:grep -lir "some text" * * text" "some -lir grep grep -lir "some text" *rootopen.com
2018-03-15 05:35:48

linux命令:grep --color=always | less -R -R less | --color=always grep grep --color=always | less -Rrootopen.com
linux命令:grep --color=always | less -R -R less | --color=always grep grep --color=always | less -Rrootopen.com
2018-02-19 22:42:48

linux命令:grep -PL "\t" -r . | grep -v ".svn" | xargs sed -i 's/\t/ /g' /g' 's/\t/ -i sed xargs | ".svn" -v grep | . -r "\t" -PL grep grep -PL "\t" -r . | grep -v ".svn" | xargs sed -i 's/\t/ /g'rootopen.com
linux命令:grep -PL "\t" -r . | grep -v ".svn" | xargs sed -i 's/\t/ /g' /g' 's/\t/ -i sed xargs | ".svn" -v grep | . -r "\t" -PL grep grep -PL "\t" -r . | grep -v ".svn" | xargs sed -i 's/\t/ /g'rootopen.com
2018-04-28 14:41:48

linux命令:grep -Eio '([[:alnum:]_.]+@[[:alnum:]_]+?\.[[:alpha:].]{2,6})' file.html file.html '([[:alnum:]_.]+@[[:alnum:]_]+?\.[[:alpha:].]{2,6})' -Eio grep grep -Eio '([[:alnum:]_.]+@[[:alnum:]_]+?\.[[:alpha:].]{2,6})' file.htmlrootopen.com
linux命令:grep -Eio '([[:alnum:]_.]+@[[:alnum:]_]+?\.[[:alpha:].]{2,6})' file.html file.html '([[:alnum:]_.]+@[[:alnum:]_]+?\.[[:alpha:].]{2,6})' -Eio grep grep -Eio '([[:alnum:]_.]+@[[:alnum:]_]+?\.[[:alpha:].]{2,6})' file.htmlrootopen.com
2018-03-25 06:13:48

linux命令:grep -h -o '<[^/!?][^ >]*' * | sort -u | cut -c2- -c2- cut | -u sort | * >]*' '<[^/!?][^ -o -h grep grep -h -o '<[^/!?][^ >]*' * | sort -u | cut -c2-rootopen.com
linux命令:grep -h -o '<[^/!?][^ >]*' * | sort -u | cut -c2- -c2- cut | -u sort | * >]*' '<[^/!?][^ -o -h grep grep -h -o '<[^/!?][^ >]*' * | sort -u | cut -c2-rootopen.com
2018-06-09 14:17:48

linux命令:grep -2 -iIr "err\|warn\|fail\|crit" /var/log/* /var/log/* "err\|warn\|fail\|crit" -iIr -2 grep grep -2 -iIr "err\|warn\|fail\|crit" /var/log/*rootopen.com
linux命令:grep -2 -iIr "err\|warn\|fail\|crit" /var/log/* /var/log/* "err\|warn\|fail\|crit" -iIr -2 grep grep -2 -iIr "err\|warn\|fail\|crit" /var/log/*rootopen.com
2018-01-31 00:45:48

linux命令:grep -v "^\W$" <filename> <filename> "^\W$" -v grep grep -v "^\W$" <filename>rootopen.com
linux命令:grep -v "^\W$" <filename> <filename> "^\W$" -v grep grep -v "^\W$" <filename>rootopen.com
2018-01-01 01:07:48

linux命令:grep -v "\ *#\|^$" /etc/path/to.config /etc/path/to.config *#\|^$" "\ -v grep grep -v "\ *#\|^$" /etc/path/to.configrootopen.com
linux命令:grep -v "\ *#\|^$" /etc/path/to.config /etc/path/to.config *#\|^$" "\ -v grep grep -v "\ *#\|^$" /etc/path/to.configrootopen.com
2018-02-22 04:35:48

linux命令:grep -r 'keyword keyword2' your/path/ | grep -v svn svn -v grep | your/path/ keyword2' 'keyword -r grep grep -r 'keyword keyword2' your/path/ | grep -v svnrootopen.com
linux命令:grep -r 'keyword keyword2' your/path/ | grep -v svn svn -v grep | your/path/ keyword2' 'keyword -r grep grep -r 'keyword keyword2' your/path/ | grep -v svnrootopen.com
2018-04-29 05:06:48

Linux的Bash命令行(A-Z排序)