Linux中head和tail方法的使用

head -5 1.txt 从第五行开始到末尾

head –n 5 1.txt 同上

head –n +5 1.txt 同上

head –n -5 1.txt 除了最后五行的所有内容 少后五行

 

tail -5 1.txt 最后五行内容

tail –n 5 1.txt 同上

tail –n -5 1.txt 同上

tail –n +5 1.txt 从正数第五行到结尾的所有内容 少前4行

扫描二维码关注公众号,回复: 3697463 查看本文章
[root@localhost yuanl]# cat headdd
1
2
3
4
5
6
7
8
[root@localhost yuanl]# head -n -5 headdd
1
2
3
[root@localhost yuanl]# tail -n +5 headdd
5
6
7
8

猜你喜欢

转载自blog.csdn.net/u013425438/article/details/80365213