小编vik*_*ani的帖子

在bash中将一行拆分为单词

我想把一行分成几个词。我知道这可以用这个来完成

For word in $line; do echo $word; done  
Run Code Online (Sandbox Code Playgroud)

但我想制作一组 3-3 个单词。所以我的问题是,如何将一行分成 3-3 个单词的组?

例如

Input : I am writing this line for testing the code.  

Output :  
I am writing
this line for
testing the code.  
Run Code Online (Sandbox Code Playgroud)

bash

5
推荐指数
1
解决办法
2904
查看次数

标签 统计

bash ×1