linux 使用笔记6
2016-03-17 15:29
429 查看
---恢复内容开始---
1、内容追加
把一个文件的内容追加到另一个文件中:
cat first.txt >> second.txt//追加到second.txt文件的末端
cat first.txt > second.txt//覆盖second.txt文件中的内容
2、查看头,尾等
查看头:
head -n my.txt//-n后加所要显示的行数
查看尾:
tail -n my.txt//-n后加所要显示的行数
查看特定的几行:
从第3000行开始,显示1000行。即显示3000~3999行
cat filename | tail -n +3000 | head -n 1000
显示1000行到3000行
cat filename| head -n 3000 | tail -n +1000
用sed命令
sed -n '5,10p' filename 这样你就可以只查看文件的第5行到第10行。
---恢复内容结束---
1、内容追加
把一个文件的内容追加到另一个文件中:
cat first.txt >> second.txt//追加到second.txt文件的末端
cat first.txt > second.txt//覆盖second.txt文件中的内容
2、查看头,尾等
查看头:
head -n my.txt//-n后加所要显示的行数
查看尾:
tail -n my.txt//-n后加所要显示的行数
查看特定的几行:
从第3000行开始,显示1000行。即显示3000~3999行
cat filename | tail -n +3000 | head -n 1000
显示1000行到3000行
cat filename| head -n 3000 | tail -n +1000
用sed命令
sed -n '5,10p' filename 这样你就可以只查看文件的第5行到第10行。
---恢复内容结束---
相关文章推荐
- linux grep命令
- Centos 安装了 Wkhtmltopdf 却依旧显示 无法打印pdf
- centos常用命令
- Linux常用命令
- centos强制删除非空文件夹
- Linux笔记(54)——while循环和until循环
- Linux笔记(53)——for循环
- Linux的Console快捷键
- 在Linux中让echo命令显示带颜色的字
- 深入分析Linux kernel exception框架---案例分析
- Linux crontab 定时
- CentOS RabbitMQ安装
- Linux的inode的理解
- CentOS下的svn强制用户提交时写日志
- 解决centos 5系统下不能上网
- linux Daemon守护进程
- 虚拟机Linux c++调用Python脚本的实现
- POSIX 线程详解
- linux 防火墙 iptables实例讲解
- CentOS6.6 下 rpm 安装mysql5.6