How do I read the first line of a file using cat?

前端 未结 11 781
渐次进展
渐次进展 2021-01-29 22:20

How do I read the first line of a file using cat?

11条回答
  •  迷失自我
    2021-01-29 22:37

    Adding one more obnoxious alternative to the list:

    perl -pe'$.<=1||last' file
    # or 
    perl -pe'$.<=1||last' < file
    # or
    cat file | perl -pe'$.<=1||last'
    

提交回复
热议问题