grep
2015-10-16 20:24
197 查看
grep "--color=auto" 搜索内容 filename
-i 区分大小写
-n 显示行号
-c 计算次数
-v 排除
-A(number) 后几行
-B(number) 前几行
c4:~# cat test
test1
test2
test3
test4
c4:~# grep -A1 test2 test
test2
test3
c4:~# grep -B1 test2 test
test1
test2
c4:~# grep -1 test2 test
test1
test2
test3
-E
-o only-matching
-o与-E结合:
c4:~# cat test
test1
test2
test3
test4
c4:~# cat test |grep -o -E e
e
e
e
e
-i 区分大小写
-n 显示行号
-c 计算次数
-v 排除
-A(number) 后几行
-B(number) 前几行
c4:~# cat test
test1
test2
test3
test4
c4:~# grep -A1 test2 test
test2
test3
c4:~# grep -B1 test2 test
test1
test2
c4:~# grep -1 test2 test
test1
test2
test3
-E
egrep 'A|B' testfile grep -E 'A|B' testfile
-o only-matching
-o与-E结合:
c4:~# cat test
test1
test2
test3
test4
c4:~# cat test |grep -o -E e
e
e
e
e
相关文章推荐
- C 语言疑难杂症 [转:http://blog.chinaunix.net/uid-20688544-id-1894880.html]
- ARC下的单例模式
- HBase的Like查询
- Android应用开发性能优化完全分析
- No3 导航控制器
- Intent中的四个重要属性——Action、Data、Category、Extras
- Scanner获取String类型的数据
- iOS之录音
- 九度oj-题目1103:二次方程计算器
- 浅谈Base64编码算法
- verilog 学习笔记
- Hash
- latex表格行号自动递增测试笔记
- 结构体最后的长度为0或1数组的作用(转载)
- Codeforces Round #326 (Div. 2)
- 【数据结构与算法分析】1.1 找出N个数字中第K大的数
- 小小菜之Cocos2d-x游戏开发旅程——项目实例:2048(1)
- Qt跨线程信号和槽的连接(默认方式是直连和队列的折中)
- Mvc--Html.ActionLink()用法
- 当析构函数遇上多进程