首页 > 系统服务 > 详细

Linux 之 grep\head\tail 命令使用(第六章)

时间:2018-05-06 10:22:49      阅读:214      评论:0      收藏:0      [点我收藏+]
grep\head\tail 命令使用

test.txt
1
2
3
4
5
6
7
8
9
10
test
liyao
oldboy


grep命令:
1.排除文本内容包括oldbody字符(grep -v 命令排除)
[root@localhost kang]# grep -v "oldboy" test.txt
1
2
3
4
5
6
7
8
9
10
test
liyao

2.只查找文件中包含oldbody字符。

[root@localhost kang]# grep "oldboy" test.txt
oldboy

head头部命令
1.查找文件前5行数据
[root@localhost kang]# head -n 5 test.txt
1
2
3
4
5


tail尾部命令
1.查找文件后面3行数据
[root@localhost kang]# tail -n 3 test.txt #默认后10行
liyao
oldboy

2.tail 动态查看后面
[root@localhost kang]# tail -fn 100 test.txt

Linux 之 grep\head\tail 命令使用(第六章)

原文:http://blog.51cto.com/12965094/2113091

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!