I have a log file (application.log) which might contain the following string of normal & special characters on multiple lines:
*^%Q&$*&^@$&*!^@$*&^&^*&^&
I want to search for the line number(s) which contains this special character string.
grep '*^%Q&$*&^@$&*!^@$*&^&^*&^&' application.log
The above command doesn't return any results.
What would be the correct syntax to get the line numbers?
Tell grep
to treat your input as fixed string using -F
option.
grep -F '*^%Q&$*&^@$&*!^@$*&^&^*&^&' application.log
Option -n
is required to get the line number,
grep -Fn '*^%Q&$*&^@$&*!^@$*&^&^*&^&' application.log