Split text on whitespace in terminal output

Revision history
Tags: grep linux

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

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.

Creative Commons License This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.