zoukankan      html  css  js  c++  java
  • 17-tail 简明笔记

    显示文件的最后一部分(尾部)

    tail [options] [file-list]

    参数

    file-listtail要显示的文件的路径名列表。当制定多个文件时,tail在显示每个文件的内容之前先显示对应的文件名

    如果不指定参数或使用连字符(-)来代替文件名,tail就从标准输入获得输入

    选项

    -c            输出最后几个字节

    -f             在文件增长时,动态追加数据

    -n            输出最后n行

    -s n         与-f选项合用,使tail每隔n秒检查一次文件的输出,默认5秒

    示例

    原文件

    复制代码
    $ cat demo
    line one
    line two
    line three
    line four
    line five
    line six
    line seven
    line eight
    line nine
    line ten
    line eleven
    复制代码

    tail

    复制代码
    $ tail demo
    line two
    line three
    line four
    line five
    line six
    line seven
    line eight
    line nine
    line ten
    line eleven
    复制代码

    显示默认的倒数10行

    tail -n

    $ tail -4 demo
    line eight
    line nine
    line ten
    line eleven

    显示指定行数的尾部

    tail -n +7

    $ tail -n +7 demo
    line seven
    line eight
    line nine
    line ten
    line eleven

    显示指定从第7行起到文件尾部

    tail -c

    $ tail -c 7 demo
    eleven

    显示指定数量的末尾字符

  • 相关阅读:
    C++探究transform算法
    C++探究foreach算法
    C++ MFC棋牌类小游戏day6
    C++ MFC棋牌类小游戏day5
    C++ MFC棋牌类小游戏day4
    C++ MFC棋牌类小游戏day3
    MFC 字体
    C++ MFC棋牌类小游戏day2
    第三章 使用属性升级MyBank
    第二章 C#语法快速热身
  • 原文地址:https://www.cnblogs.com/luoahong/p/6188575.html
Copyright © 2011-2022 走看看