在shell脚本中使用#标签匹配所有单词

Roh*_*pra 3 bash shell sh

任何人都可以使用shell脚本快速提取给定句子中的所有主题标签.

例如: 'This is a #test that will #allow me to #remove stuff'会回来#test #allow #remove

Mat*_*ave 6

你可能想试试egrep -o '#[^ ]+'.输出应如下所示:

#test
#allow
#remove
Run Code Online (Sandbox Code Playgroud)