• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Re: logfile select-string

K

Kiron

#1
Use the -Replace operator and zero-width assertion, i.e. 'lookahead' and 'lookbehind', in the RegEx.

sal ss select-string -ea 0
# all addresses by SessionId
ss (ss \@eurocollege.nl MailLog |
% {$_.line -replace '.+(?<=\()(\w+)(?=\)).+','$1.+RCPT TO'} |
sort -unique) MailLog |
% {$_.line -replace '.+(?<=RCPT TO:)(<.+>).*','$1'}

# showing SessionID:
$sessionIDs = ss \@eurocollege.nl MailLog |
% {$_.line -replace '.+(?<=\()(\w+)(?=\)).+','$1'} | sort -unique
$sessionIDs | % {
$_
ss "$_.+RCPT TO" MailLog |
% {$_.line -replace '.+(?<=RCPT TO:)(<.+>).*','$1'}
}

--
Kiron
 

My Computer

Users Who Are Viewing This Thread (Users: 1, Guests: 0)