以下是grep命令大全,在Ubuntu下可以使用grep --help 或者 man -k grep 等查阅grep命令
Regexp selection and interpretation:
-E, --extended-regexp PATTERN is an extended regular expression (ERE)
-F, --fixed-strings PATTERN is a set of newline-separated fixed strings
-G, --basic-regexp PATTERN is a basic regular expression (BRE)
-P, --perl-regexp PATTERN is a Perl regular expression
-e, --regexp=PATTERN use PATTERN for matching
-f, --file=FILE obtain PATTERN from FILE
-i, --ignore-case ignore case distinctions
-w, --word-regexp force PATTERN to match only whole words
-x, --line-regexp force PATTERN to match only whole lines
-z, --null-data a data line ends in 0 byte, not newline
Miscellaneous:
-s, --no-messages suppress error messages
-v, --invert-match select non-matching lines
-V, --version print version information and exit
--help display this help and exit
--mmap ignored for backwards compatibility
Output control:
-m, --max-count=NUM stop after NUM matches
-b, --byte-offset print the byte offset with output lines
-n, --line-number print line number with output lines
--line-buffered flush output on every line
-H, --with-filename print the file name for each match
-h, --no-filename suppress the file name prefix on output
--label=LABEL use LABEL as the standard input file name prefix
-o, --only-matching show only the part of a line matching PATTERN
-q, --quiet, --silent suppress all normal output
--binary-files=TYPE assume that binary files are TYPE;
TYPE is `binary', `text', or `without-match'
-a, --text equivalent to --binary-files=text
-I equivalent to --binary-files=without-match
-d, --directories=ACTION how to handle directories;
ACTION is `read', `recurse', or `skip'
-D, --devices=ACTION how to handle devices, FIFOs and sockets;
ACTION is `read' or `skip'
-R, -r, --recursive equivalent to --directories=recurse
--include=FILE_PATTERN search only files that match FILE_PATTERN
--exclude=FILE_PATTERN skip files and directories matching FILE_PATTERN
--exclude-from=FILE skip files matching any file pattern from FILE
--exclude-dir=PATTERN directories that match PATTERN will be skipped.
-L, --files-without-match print only names of FILEs containing no match
-l, --files-with-matches print only names of FILEs containing matches
-c, --count print only a count of matching lines per FILE
-T, --initial-tab make tabs line up (if needed)
-Z, --null print 0 byte after FILE name
Context control:
-B, --before-context=NUM print NUM lines of leading context
-A, --after-context=NUM print NUM lines of trailing context
-C, --context=NUM print NUM lines of output context
-NUM same as --context=NUM
--color[=WHEN],
--colour[=WHEN] use markers to highlight the matching strings;
WHEN is `always', `never', or `auto'
-U, --binary do not strip CR characters at EOL (MSDOS)
-u, --unix-byte-offsets report offsets as if CRs were not there (MSDOS)
在工作中,以上命令并不是都用。下面我列举一些我常用的命令。
以adb logcat 查询日志说明。
1、grep “xxx” 查询所有包含“xxx”的内容,忽略大小写
adb logcat | grep ""
以上是过滤所有包含有“”字符串的日志,且忽略大小写
2、grep -E“xxx|ooo”的或操作
adb logcat | grep -E "|读书导航|极客导航"
以上是过滤所有日志中包含“”或 “读书导航”或“极客导航”的所有日志
3、 grep -v “xxx”忽略操作
adb logcat | grep -v ""
以上操作是只是过滤掉含有“”的日志,显示其他所有日志
如果是大写的-V是查询grep的版本。
目前就这些,后续增加。
历史上的今天
暂无评论...
随机推荐
ARGB 颜色取值与透明度对照表
什么是ARGBARGB 依次代表透明度(alpha)、红色(red)、绿色(green)、蓝色(blue)。Android颜色值格式Android中的颜色值一般格式是:#AARRGGBB。AA就是透明度值RRGGBB是颜色值例子如果UI设计师给的视觉稿标注是:颜色#FFFFFF,透明...
张枣:镜中
只要想起一生中后悔的事梅花便落了下来 比如看她游泳到河的另一岸比如登上一株松木梯子危险的事固然美丽 不如看她骑马归来面颊温暖羞涩。低下头,回答着皇帝 一面镜子永远等候她让她坐到镜中常坐的地方望着窗外,只要想起一生中后悔的事梅花便落满了南山
个人常用的GridView方法简介
前言Android中GridView还是比较常用的,GridView有些方法或者配置属性都是比较常用也比较容易忘记的。因此,今天抽空整(抄)理(袭)一下,以便查阅。PS: 现在RecyclerView比较多了正文GridView跟ListView有很多一样的属性或者方法。因此这里就更简...
ActionBar中Menu使用
前言简单记录一下标题栏中Menu的使用。流水文,之前没记录,这次有空重新简单记录一下。正文在Android Studio中新创建一个Module。在res目录创建menu,然后创建一个menu.xml/res/menu/menu.xmlmenu.xml<menu xmlns:a...
wordpress隐藏文章的部分内容,登录可见
前言隐藏文章的部分内容,需要注册登录网站后可见正文下面是实现代码和使用方式。function.php 末尾/** * WordPress 只允许已登录的用户查看文章内容 */add_shortcode( 'members_only', 'members_only_shortcode...
修改Framework画中画(pip)中默认UI和逻辑定制
前言记录一下自己修改Android画中画UI界面和定制化逻辑。记录一下,方便自己查阅。正文如上图,一个六个按钮。对于自定义界面的话,会改如下删除[设置]按钮去除双击进入全屏播放(容易误操作),只有点击[]后才进入全屏播放优化X退出PIP时声音和画面不同步暂停问题隐藏内容!付...