Answer the question
In order to leave comments, you need to log in
How to find a plain text string using grep?
Find a line in a file. The string can be in the form of a regular expression or even consist of any characters.
I tried this:
The -F parameter allows you to interpret the search query as a string, but the hyphens at the beginning spoil everything. grep thinks this is a parameter for it and throws an error.
Escaping in regular expressions seems very complicated to me. Since the search string can consist of any number of any characters.
How to get out of the situation?
grep -x -F --max-count=1 "--ma.y3[4]$%#$^" file
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question