In Linux system, when there is a backslash in the text, you need to use grep to find out the content with the backslash, such as the following text
aaa bbb cccccc ddd\teee ffffff
Want to find the text of the line ddd\teee
If you use cat |grep "ddd\teee" or cat |grep "ddd\teee to add an escape, you can't find it
At least three backslashes need to be added, for example
cat /tmp/|grep "ddd\\\teee This way you can find this line
Add a few more, such as
cat /tmp/|grep "ddd\\\\teee cat /tmp/|grep "ddd\\\\\teee cat /tmp/|grep "ddd\\\\\\teee
No matter how many, it won't work
For example, add 7
cat /tmp/|grep "ddd\\\\\\\teee, so you can't find it
Here is the multi-layer escape problem of grep
linux ^ special characters split \ escape , windows \\^ escape
linux ^ special characters split ^ escape , under windows \^ escape.
If it is B then ^B^ escape; if it is B then \B\ escape
This is the article about the problem of matching backslashes\escaping when searching for text in Linux. This is the end of this. For more related content on linux grep escape, please search for my previous articles or continue browsing the related articles below. I hope everyone will support me in the future!