gpt4 book ai didi

scripting - sed脚本以在每行中打印前三个单词

转载 作者:行者123 更新时间:2023-12-03 08:18:51 27 4
gpt4 key购买 nike

我想知道如何使用sed执行以下操作:
我只需要在每行中保留前三个单词。
例如,以下文本:

the quick brown fox jumps over the lazy bear
the blue lion is hungry

将转换为:
the quick brown
the blue lion

最佳答案

您可以像这样使用cut:

cut -d' ' -f1-3

关于scripting - sed脚本以在每行中打印前三个单词,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4998349/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com