码迷,mamicode.com
首页 > 系统相关 > 详细

linux中查找和过滤的用法:find,grep

时间:2016-01-30 22:35:56      阅读:175      评论:0      收藏:0      [点我收藏+]

标签:

FIND:

技术分享
技术分享
技术分享
技术分享
技术分享

技术分享
技术分享
技术分享
Grep:
过滤:

grep -i -c root /tmp/a.txt --color                查找a.txt中包含root的字符

-i:忽略大小写
-c:统计个数
-n:显示查找出来的在第几行
-v:反转查找
^root    :以root开头
root$    :以root结尾
^root$    :空行

只显示IP地址:
ifconfig eth0|grep "inet addr" |awk ‘{print $2}‘|awk -F : ‘{print $2}‘

技术分享
技术分享
技术分享
技术分享







linux中查找和过滤的用法:find,grep

标签:

原文地址:http://www.cnblogs.com/xiaoxiao5ya/p/a8165e4220ad73401de3719a78b50cd0.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!