匹配一行与文字星号“*”在grep [英] matching a line with a literal asterisk "*" in grep
本文介绍了匹配一行与文字星号“*”在grep的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
试过
$ echo$ STRING| egrep(\ *)
还有
$ echo$ STRING| egrep'(\ *)'
以及无数其他变体。我只想匹配一行中包含文字星号的行。
尝试一个字符类,而不是 echo$ STRING| egrep'[*]'
Tried
$ echo "$STRING" | egrep "(\*)"
and also
$ echo "$STRING" | egrep '(\*)'
and countless other variations. I just want to match a line that contains a literal asterisk anywhere in the line.
解决方案
Try a character class instead
echo "$STRING" | egrep '[*]'
这篇关于匹配一行与文字星号“*”在grep的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文