unix - head AND tail of file

前端 未结 20 1224
误落风尘
误落风尘 2020-12-07 11:05

Say you have a txt file, what is the command to view the top 10 lines and bottom 10 lines of file simultaneously?

i.e. if the file is 200 lines long, then view lines

20条回答
  •  不思量自难忘°
    2020-12-07 11:29

    To print the first 10 and last 10 lines of a file, you could try this:

    cat <(head -n10 file.txt) <(tail -n10 file.txt) | less

提交回复
热议问题