[H-GEN] Scripting guide

Russell Stuart russell at stuart.id.au
Thu May 25 02:44:35 EDT 2006


On 25/05/2006 4:35 PM, Kelvin Heng wrote:
> 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

Use fgrep, or pass the -F option to grep.





More information about the General mailing list