Split text on whitespace in terminal output
- 28 Nov 2017: Post was created (diff)
To split text on whitespace you can use grep
. There’s an infinite amount of ways to do this. This is one of them.
$ echo 'string --with ###ALLKINDS### 0f ::outputs' | grep -oP '[^\s]+'
string
--with
###ALLKINDS###
0f
::outputs
References
man grep
If you have any comments or feedback, please send me an e-mail. (stig at stigok dotcom).
Did you find any typos, incorrect information, or have something to add? Then please propose a change to this post.