zoukankan      html  css  js  c++  java
  • 16-head 简明笔记

    显示文件的头部

    head [options] [file-list]

    参数

    file-list 为要head显示的文件的路径名列表。当指定多个文件时,head在显示每个文件的前几行内容之前显示对应的文件名

    当不指定文件时,head将从标准输入获得输入

    选项

    -c n                显示文件的前n个字节(字符)

    -n n                显示文件的前n行,也可以使用-n来指定显示的n行

    -q                   当在命令行上指定多个文件名时,它禁止显示头部

    注意

    默认情况下,head将显示文件的前10行

    示例

    原文件

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

    head

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

    默认显示10行

    head -n

    $ head -n 4 demo
    line one
    line two
    line three
    line four

    显示指定的行数

    head -n 负数

    复制代码
    $ head -n -4 demo
    line one
    line two
    line three
    line four
    line five
    line six
    line seven
    复制代码

    显出除最后4行外的其他行

    head -3 多个文件

    复制代码
    $ head -3 demo dd
    ==> demo <==
    line one
    line two
    line three
    
    ==> dd <==
    line one
    line two
    line three
    复制代码

    显示多个文件的前3行

    head -c

    $ head -c 4 demo
    line$ 

    显示文件的前4个字符,注意此处不换行

  • 相关阅读:
    Word Search
    Subsets
    Combinations
    Search a 2D Matrix
    求比正整数N大的最小正整数M,且M与N的二进制表示中有相同数目的1
    Set Matrix Zeroes
    Unity学习笔记—— 常用脚本函数
    学习 各个数据结构
    unity调用 安卓相册
    设置 相机跟随 主角及视角 滑动
  • 原文地址:https://www.cnblogs.com/luoahong/p/6188568.html
Copyright © 2011-2022 走看看