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