您的位置:首页 > 运维架构 > Linux

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行。

---恢复内容结束---
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: