telemorgan
MIS
I am writing a script that will read each line of a log file and pull out the user name string. The log file is populated with lines like this:
11.111.247.148 - (CN=Blow\\, Joe,CN=Users,DC=CompanyX,DC=com)@(LDAP) [06/May/2008:08:33:23 -0400] "GET 11.111.247.148 - - [06/May/2008:08:33:24 -0400] "GET /exchweb/6.5.7651.60/controls/blank.htm
111.111.247.148 - (CN=TheTank\\, Frank,CN=Users,DC=CompanyAB,DC=com)@(LDAP) [06/May/2008:08:33:25 -0400] "GET HTTP/1.1"
11.11.148.211 - (CN=BeanStalk\\, Jacknda,CN=Users,DC=CompanyFF,DC=com)@(LDAP) [06/May/2008:08:33:25 -0400] "GET
What would be the regular expression to pull the user name string from the line? For example, from the first line I am looking to pull only (CN=Blow\\, Joe,CN=Users,DC=CompanyX,DC=com).
Also some of the lines as you can see do not have any username assosiated with them. I need to just disregard those lines. Those lines start with a [ instead of a ( though after the ip.
Thanks in advance.
11.111.247.148 - (CN=Blow\\, Joe,CN=Users,DC=CompanyX,DC=com)@(LDAP) [06/May/2008:08:33:23 -0400] "GET 11.111.247.148 - - [06/May/2008:08:33:24 -0400] "GET /exchweb/6.5.7651.60/controls/blank.htm
111.111.247.148 - (CN=TheTank\\, Frank,CN=Users,DC=CompanyAB,DC=com)@(LDAP) [06/May/2008:08:33:25 -0400] "GET HTTP/1.1"
11.11.148.211 - (CN=BeanStalk\\, Jacknda,CN=Users,DC=CompanyFF,DC=com)@(LDAP) [06/May/2008:08:33:25 -0400] "GET
What would be the regular expression to pull the user name string from the line? For example, from the first line I am looking to pull only (CN=Blow\\, Joe,CN=Users,DC=CompanyX,DC=com).
Also some of the lines as you can see do not have any username assosiated with them. I need to just disregard those lines. Those lines start with a [ instead of a ( though after the ip.
Thanks in advance.