Saturday, 17 August 2013

Finding a whole string using grep

Finding a whole string using grep

I'm trying to find whole strings using grep. I am familiar with -w flag,
but it gives me hard time since it refers a dot as a delimiter.
For example, I have a file named "a.txt" and a directory names a in some
directory, this is what happens:
> ls | grep -w a
a
a.txt
What I want it to find is only "a" and that's it.
How can I do that?

No comments:

Post a Comment