Software >> OS >> Unix >> Commands >> grep >> How to search for backslash character

backslash need special handling, need to escape \ with another \ for the shell, need to escape \ with another \ for the grep command

e.g. to search for \..\ in myfile.txt

 

The test file :-

case 1: grep without enclosing the pattern within quotes :-

 

case 2: grep using quotes to enclose the escaped backslash (backslash+backslash)