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.
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.
If there is a need to detect an asterisk in awk, you can either use
awk '/\*/' file
Here, * is used in a regex, and thus, must be escaped since an unescaped * is a quantifier that means "zero or more occurrences". Once it is escaped, it no longer has any special meaning.
Alternatively, if you do not need to check for anything else, it makes sense to peform a fixed string check:
awk 'index($0, "*")' file
If * is found anywhere inside a "record" (i.e. a line) the current line will get printed.