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个字符,注意此处不换行

  • 相关阅读:
    DICOM 协议学习笔记之 What is DICOM
    决策树(ID3,C4.5,CART)
    支持向量机(support vector machines, SVM)
    回归分析-线性回归与逻辑回归
    第8章 线程
    第7章 常用实用类
    第5章 语法制导翻译及中间代码生成
    第4章 语法分析
    第3章 词法分析
    第2章 形式语言基础知识
  • 原文地址:https://www.cnblogs.com/luoahong/p/6188568.html
Copyright © 2011-2022 走看看