[H-GEN] Scripting guide

David Ash dash at redhat.com
Thu May 25 02:46:17 EDT 2006


Kelvin Heng wrote:
> [ Humbug *General* list - semi-serious discussions about Humbug and     ]
> [ Unix-related topics. Posts from non-subscribed addresses will vanish. ]
> 
> hi guys,
> 
> I am to write a script to retrieve the IP address from a list of log 
> files, and if the IP address matches the ones I need then I will take 
> them out.
> But I am facing some problem with the dot (.) between IP address. Can 
> someone help me with this?
> 
> testfile:
> a
> aa
> aaa
> .aa
> a.a
> aa.
> 
> Test 1:
> $ grep -w a testfile
> a
> a.a
> 
> Test 2:
> $ grep -w "a." testfile
> aa
> .aa
> aa.
> 
> Test 3:
> $ grep "a.a" testfile
> aaa
> a.a


"." means any character.  Do you mean to escape it with a "\" ie. "\."?




More information about the General mailing list