Blogger

Delete comment from: Javarevisited

Adi said...

Can you please suggest grep command examples for following scenario:

How to grep for String with spaces something like
grep ' ABC' file

I think this will work because quotes will include the spaces as well while searching.

How to grep for String with double quotes inside like

grep '"ABC"' file

this will also work because single quote treats double quotes as literal, please check if it doesn't work and why.

How to grep for String with single quotes in it?
for example if I want to search for word don't which has single quote on it, will following grep command work :

grep "don't" file

How to escape characters while using grep command in Unix ?


Aug 14, 2012, 4:50:02 AM


Posted to 10 examples of grep command in UNIX and Linux

Google apps
Main menu