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

查看Linux里某文件的前面/后面几行中的某一行

时间:2016-11-05 15:02:24      阅读:246      评论:0      收藏:0      [点我收藏+]

标签:size   etc   linu   span   管道   bsp   linux   str   tail   

 

  如,我想看/etc/profile文件的前5行里的第5行。

则,   head -5 /etc/profile  |  tail -1 

  管道|啊,很简单,就是把左边命令的结果,作为右边的输入。

 

  如,我想看/etc/profile文件的后5行的第1行

则,  tail -5 /etc/profile  |   head 1

查看Linux里某文件的前面/后面几行中的某一行

标签:size   etc   linu   span   管道   bsp   linux   str   tail   

原文地址:http://www.cnblogs.com/zlslch/p/6032988.html

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