grep

作者: lindyang | 来源:发表于2018-11-02 15:57 被阅读0次

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

In basic regular expressions the metacharacters 
  ? , + , { , | , ( , and  )
lose their special meaning; instead use the backslashed versions:
 \? ,\+ ,\{ ,\| ,\( , and \)
  • -v (invert-match)
  • -c (count)
  • -m (max-count)
  • -n (line-number)
  • -L (files-without-match)
  • -l (files-with-matches)
  • --include=PATTERN
  • --exclude=PATTERN
  • -q(quiet)
  • -s(no-messages)
  • > /dev/null
  • -A(after)
  • -B(before)
  • -C(context)
  • --binary-files=TYPE

TYPE:

  • binary(default)
  • without-match(-I)
  • text(-a)
  • --color

GREP_COLOR

  • never
  • auto
  • always
  • -G(basic-regexp, default)
  • -E(extended-regexp)
  • -P(perl-regexp)
  • -F(fixed-strings)
grep -F -e "one" -e "two" file

grep -F 'one
two' file
  • -f(file)
  • -b(byte-offset)
  • -u(unix-byte-offsets)

相关文章

网友评论

      本文标题:grep

      本文链接:https://www.haomeiwen.com/subject/jetyoftx.html