I want grep to grep one word which is having spaces it
22,927
Solution 1
Just add quotes around your grep
command:
grep "s a i" "another directory/xyz.txt"
Solution 2
You can escape the space with a backslash:
grep My\ Documents
Author by
Admin
Updated on March 04, 2020Comments
-
Admin about 4 years
I would like to grep the word “s a i” (which has spaces in it) in a
xyz.txt
file which is saved in another directory. I tried to find an answer but I didn’t manage to find any. I have to use thegrep
command only.