Help with egrep command

Hi All,

I am using egrep command to search one pattern. Following is the command i am using

egrep -i "ACL*" filename

but its also giving me the records which do not contain ACL.
any help would be appreciated.

Regards,
Sam

Hi.

ACL* means AC and zero or more L's.

Because you've used the -i (ignore case) it will find any combination of ac, aC Ac, AC, etc. with or without an L (or l)

If you want to find ACL followed by anything, use ACL.*

(and I would use grep -E instead of egrep)

The regex pattern you have 'ACL*' will match any substring containing ACL with the L char. repeated from 0 (none) to ...wel, a lot.

AC or ACLL ACLLLL etc...

if u r looking for exact search of ACL u can try this

egrep -i "^ACL$" <inputfile>