linux 如何显示一个文件的某几行(中间几行)
来源:互联网 发布:重力感应效果 js 编辑:程序博客网 时间:2024/06/05 19:24
【一】从第3000行开始,显示1000行。即显示3000~3999行
cat filename | tail -n +3000 | head -n 1000
【二】显示1000行到3000行
cat filename| head -n 3000 | tail -n +1000
*注意两种方法的顺序
分解:
tail -n 1000:显示最后1000行
tail -n +1000:从1000行开始显示,显示1000行以后的
head -n 1000:显示前面1000行
【三】用sed命令
sed -n '5,10p' filename 这样你就可以只查看文件的第5行到第10行。
一般查看文件:
cat test.txt
tail -f test.txt
若有关键词:
cat test.txt|grep 'xxx'
tail -f test.txt|grep 'xxx'
条件多了,可以多加几个grep
cat test.txt|grep 'xxx' |grep 'yyy'
tail -f test.txt|grep 'xxx' |grep 'yyy'
0 0
- linux 如何显示一个文件的某几行(中间几行)
- linux 如何显示一个文件的某几行(中间几行)
- linux 如何显示一个文件的某几行(中间几行)
- linux 如何显示一个文件的某几行(中间几行)
- linux 如何显示一个文件的某几行(中间几行)
- linux 如何显示一个文件的某几行(中间几行)
- linux 如何显示一个文件的某几行(中间几行)
- linux 如何显示一个文件的某几行(中间几行)
- linux 如何显示一个文件的某几行(中间几行)
- linux 如何显示一个文件的某几行(中间几行)
- linux 如何显示一个文件的某几行(中间几行)
- linux 如何显示一个文件的某几行(中间几行)
- linux 如何显示一个文件的某几行(中间几行)
- linux 如何显示一个文件的某几行(中间几行)
- linux 如何显示一个文件的某几行(中间几行)
- linux 如何显示一个文件的某几行(中间几行)
- linux 如何显示一个文件的某几行(中间几行)
- linux 如何显示一个文件的某几行(中间几行)
- WEBRTC 媒体引擎MediaEngine
- Spring MVC请求处理流程及架构
- linux常用命令3
- Java-类库-Guava-Multimap
- osx + Intellij + mysql + jsp + tomcat 之java web项目-网上书店 (上) (mysql的配置)
- linux 如何显示一个文件的某几行(中间几行)
- 深度|NTM-Lasagne:基于Lasagne的神经图灵机函数库
- Azure 高级版 Redis 如何持久化
- 重写 WaitDialogForm 控件
- 用 ASTERISK 搭建自己的免费 VOIP 服务器
- 剑指offer-数组中只出现一次的数字
- 初涉JavaScript 4
- CSS中<li>标签横向排列出现间距问题
- telnet不能用!!!提示:-bash: telnet: command not found