shell grep用法
来源:互联网 发布:淘宝店铺地址是无效的 编辑:程序博客网 时间:2024/05/21 06:01
常用的grep选项
-c 只输出匹配行的计数
-i 不区分大小写(只适用于单字符)
-h 查询多文件时不显示文件名
-l 列出匹配的文件名
-L 列出不匹配的文件名
-n 显示匹配行及行号
-s 不显示不存在或者无匹配文本的错误提示信息
-v 显示不包含匹配文本的所有行
-r 搜素子目录
-w 匹配整个单词
-d skip 忽略子目录
例子:
查找以一个数字开头并且以一个和开头数字相同的数字结尾的行 cat x.txt | grep "\(^[0-9]\).*\1$" 或者 cat x.txt | grep ^[0-9].*1$
使用grep 把ifconfig中的ip地址提取出来但是不包括127.0.0.1 ifconfig | grep "inet addr" | grep -v '127.0.0.1' | cut -d: -f2 | awk '{ print $1}'
- shell grep用法
- linux shell grep的用法
- shell学习之- grep 用法简明分析
- shell脚本系列-grep用法总结
- shell学习之- grep 用法简明分析
- shell学习之- grep 用法简明分析
- shell脚本系列-grep用法总结
- shell中管道、grep、sed、awk用法
- linux shell用法(7)-- grep命令
- shell脚本系列-grep用法总结
- 【shell】grep命令及常见用法
- 【shell】grep
- shell-grep
- shell-grep
- shell grep
- linux shell 脚本之深入浅出的grep的用法
- shell用法(包括awk sed grep eval expr等)
- linux shell 脚本之深入浅出的grep的用法
- 算法导论 3.1-6
- first
- Flex拖动实现方法-孙镜涛
- oracle like匹配单引号
- performSelector & @selector
- shell grep用法
- jsp实现文件下载传输,已隐藏源文件路径
- 黑马程序员——存储过程
- Mysql导出.sql文件及常用命令
- java多线程总结
- 使用WinDbg作为默认调试器, 调试本机应用程序
- 上班一年的感悟
- WINCE6.0在控制面板添加应用程序
- C++多态个人总结