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.
When an asterisk ( * ) follows a character, grep interprets it as "zero or more instances of that character." When the asterisk follows a regular expression, grep interprets it as "zero or more instances of characters matching the pattern." You may want to try this to see what happens otherwise.
If you include special characters in patterns typed on the command line, escape them by enclosing them in single quotation marks to prevent inadvertent misinterpretation by the shell or command interpreter. To match a character that is special to grep –E, put a backslash ( \ ) in front of the character.
The [a-z]+ matches one or more lowercase letters. The [*]? matches zero or one asterisks. The $ matches the end of the string.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With