简体   繁体   English

前五行标准输出,bash

[英]first five lines of stdout, bash

How can I chop off everything but the first five lines using a bash pipe? 我如何使用bash管道切掉除前五行之外的所有内容? For example: 例如:

cat file.txt | truncate 5

would only print the first five lines. 只会打印前五行。 Ideas? 有想法吗?

您需要head命令。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM