我的VPN设备中有一个巨大的日志文件,我想将其缩减为Domain\Username
。在Domain\Username
之后有一些文本变体,但它都以日期(变化),时间(变化), - 访问 - DC - (一致),以及括号内的IP地址(括号保留但IP变化)开始。用户名长度也有所不同。任何帮助表示赞赏。
是的,我对RegEx很陌生......我正在使用Notepad ++来降低它。希望文本最后显示为Domain\username
。我已经尝试了几个表达式来修剪它,但只是部分成功,因为Domain\Username
之后的文本变化,所以留下了很多行。
实施例。 .*(?<=Username:)
和(?>,).*
示例数据:
2017-06-29 07:27:13 - Access-DC - [10.10.25.294] Domain\username(Basic Domain Access)[Basic Employee Access] - Web SSO: Authentication successful. Credential Used: Username: username, Error: (0) Initial, Realm: Domain.COM, Auth Type: (32) Kerberos, Cred Type: (0) System Credential, Target: server.Domain.com, Password: XXXXXX, Has Ticket: 1, Policy Auth: (32) Kerberos, Cred Label: Default, Server Realm: Domain.COM,
2017-06-29 07:27:13 - Access-DC - [10.5.27.236] Domain\username(Basic Domain Access)[Basic Employee Access] - Web SSO: Authentication successful. Credential Used: Username: username, Error: (0) Initial, Realm: Domain.COM, Auth Type: (32) Kerberos, Cred Type: (0) System Credential, Target: server.Domain.com, Password: XXXXXX, Has Ticket: 1, Policy Auth: (32) Kerberos, Cred Label: Default, Server Realm: Domain.COM,
2017-06-29 07:27:13 - Access-DC - [10.5.27.236] Domain\username(Basic Domain Access)[Basic Employee Access] - Web SSO: Authentication successful. Credential Used: Username: username, Error: (0) Initial, Realm: Domain.COM, Auth Type: (32) Kerberos, Cred Type: (0) System Credential, Target: server.Domain.com, Password: XXXXXX, Has Ticket: 1, Policy Auth: (32) Kerberos, Cred Label: Default, Server Realm: Domain.COM,
期望的输出:
Domain\username
Domain\username
Domain\username