查找具有 2 个或更多 * 的字符
Find characters that have 2 or more *
如果我想显示有 2 倍或更多字符的行 *
。
egrep '*{2}' file
您可以使用
grep '\*[^*]*\*' file
\*[^*]*\*
模式将匹配具有 *
的行,然后是 *
以外的任何 0+ 个字符,然后是 *
.
s="*one
*two*
.... *three* and more text here**"
grep '\*[^*]*\*' <<< "$s"
输出:
*two*
.... *three* and more text here**
如果我想显示有 2 倍或更多字符的行 *
。
egrep '*{2}' file
您可以使用
grep '\*[^*]*\*' file
\*[^*]*\*
模式将匹配具有 *
的行,然后是 *
以外的任何 0+ 个字符,然后是 *
.
s="*one
*two*
.... *three* and more text here**"
grep '\*[^*]*\*' <<< "$s"
输出:
*two*
.... *three* and more text here**