如何显示在UNIX的文件的第n行的所有行 [英] How to display all the lines from the nth line of a file in unix

查看:306
本文介绍了如何显示在UNIX的文件的第n行的所有行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要显示从第n行开始的所有行。说,打印文件的第三行和下面的所有行,直到文件结束。是否有一个命令是什么?


解决方案

您可以用尾巴

从手册页摘录:


  -n,--lines = K
         输出的最后K行的,而不是最后10;或者使用-n + K到
         开始的第K个输出线


例如:

 尾-n +10文件

输出文件的内容开始的10日线

I want to display all the lines starting from the nth line. Say, print the third line of a file and all the following lines until end of file. Is there a command for that?

解决方案

you can use tail

excerpt from the manpage:

   -n, --lines=K
         output the last K lines, instead of the last 10; or use -n +K to
         output lines starting with the Kth

for example

tail -n +10 file 

outputs the files content starting with the 10th line

这篇关于如何显示在UNIX的文件的第n行的所有行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆