linux 如何显示一个文件的某几行(中间几行)
2015-04-16 22:22
176 查看
http://www.cnblogs.com/xianghang123/archive/2011/08/03/2125977.html
【一】从第3000行开始,显示1000行。即显示3000~3999行cat filename | tail -n +3000 | head -n 1000
【二】显示1000行到3000行
cat filename| head -n 3000 | tail -n +1000
查看文件倒数3000~倒数2000行之间的数据:
cat filename | tail -n 3000 | head -n 1000
或者:
tail -n 3000 filename | head -n 1000
*注意两种方法的顺序
分解:
tail -n 1000:显示最后1000行
tail -n +1000:从1000行开始显示,显示1000行以后的
head -n 1000:显示前面1000行
【三】用sed命令
sed -n '5,10p' filename 这样你就可以只查看文件的第5行到第10行。
相关文章推荐
- linux 如何显示一个文件的某几行(中间几行)
- linux 如何显示一个文件的某几行(中间几行)
- linux 如何显示一个文件的某几行(中间几行)(转载)
- linux 如何显示一个文件的某几行(中间几行)
- linux 如何显示一个文件的某几行(中间几行)
- linux 如何显示一个文件的某几行(中间几行)
- linux 如何显示一个文件的某几行(中间几行)
- linux 如何显示一个文件的某几行(中间几行)
- linux 如何显示一个文件的某几行(中间几行)
- linux 如何显示一个文件的某几行(中间几行),以及常用命令
- linux 如何显示一个文件的某几行(中间几行)
- linux 如何显示一个文件的某几行(中间几行)
- linux 如何显示一个文件的某几行(中间几行)
- linux 如何显示一个文件的某几行(中间几行)
- linux 如何显示一个文件的某几行(中间几行)
- linux 如何显示一个文件的某几行(中间几行)
- linux 如何显示一个文件的某几行(中间几行)
- linux 如何显示一个文件的某几行(中间几行)
- linux 如何显示一个文件的某几行(中间几行)
- linux 如何显示一个文件的某几行(中间几行)