匹配带有文字星号“*"的行在 grep [英] matching a line with a literal asterisk "*" in grep

查看:15
本文介绍了匹配带有文字星号“*"的行在 grep的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试过

$ echo "$STRING" | egrep "(*)"

还有

$ echo "$STRING" | egrep '(*)'

以及无数其他变体.我只想匹配一行中任何位置包含文字星号的行.

and countless other variations. I just want to match a line that contains a literal asterisk anywhere in the line.

推荐答案

尝试改用字符类

echo "$STRING" | egrep '[*]' 

这篇关于匹配带有文字星号“*"的行在 grep的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆