I found a few questions here similar to this but they are not quite identical.
I want to grep for the text 'true' format in certain files.
How do I do it?
Not sure how to escape the single quotes around true.
Just wrap the string within double quotes:
grep "'true' format" your_file
$ cat a
this is 'true' format
and this is true formatting
test
$ grep "'true' format" a
this is 'true' format
If you can use the -P (Perl regex syntax) flag of grep, then you can encode ' as \x27 in the pattern:
grep -P '\x27true\x27 format' file.txt
(Similarly, for " use \x22)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With