[wplug] shell trick?

D. Joe wplug at etrumeus.com
Sun May 28 12:09:00 EDT 2006


On Sun, May 28, 2006 at 03:49:26PM +0000, Zach wrote:
> i am trying to grep a very large file (50MB) for hostnames containing
> ".at" (Austria),
> i tried "grep ".at" *" and it is giving references for "at" but i
> don't want the word at i just want ".at", anyone know a way to do
> this?

You need to escape the . in such a way that the shell doesn't
gobble up your escape before it gets to grep:

    11:06:36 $ cat greptest
   take that, you varmit
   at home
   .at Der Arnieland

    11:06:40 $ grep .at greptest
   take that, you varmit
   .at Der Arnieland
    11:06:47 $ grep \.at greptest
   take that, you varmit
   .at Der Arnieland
    11:06:50 $ grep \\.at greptest
   .at Der Arnieland
    11:06:53 $ grep '\.at' greptest
   .at Der Arnieland

So, either of these last two seem to be what you want.

-- 
D. Joe Anderson        http://www.etrumeus.com/~deejoe
deejoe at etrumeus.com
  


More information about the wplug mailing list