Guest User

Untitled

a guest
Jun 25th, 2018
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.63 KB | None | 0 0
  1. Get-Content $tempDir$todaysLog | Where-Object { $_ -match "" } |
  2. ForEach-Object -Process {
  3. $fields = [regex]::split($_,'@|s+')
  4. Add-Content -Path $importSource2$todaysLog -value ($($fields[0]) + "`t" + $($fields[1]) + "`t" + $($fields[2]) + " " + $($fields[3])+ "`t" + "<*sender*@"+($($fields[5])) + "`t" + "<*recipient*@"+($($fields[7])))
  5. }
  6.  
  7. cat $tempDir$todaysLog |
  8. %{ [regex]::Replace($_, "[A-Z0-9._%+-]+(@[A-Z0-9.-]+.[A-Z]{2,4}s<[')[A-Z0-9._%+-]+(@[A-Z0-9.-]+.[A-Z]{2,4}']>)", '*sender*$1*recipients*$2', "IgnoreCase") } > $importSource2$todaysLog
  9.  
  10. Measure-Command {
  11.  
  12. Get-Content $tempDir$todaysLog | Where-Object { $_ -match "" } |
  13. ForEach-Object -Process {
  14. $fields = [regex]::split($_,'@|s+')
  15. Add-Content -Path $importSource2$todaysLog -value ($($fields[0]) + "`t" + $($fields[1]) + "`t" + $($fields[2]) + " " + $($fields[3])+ "`t" + "<*sender*@"+($($fields[5])) + "`t" + "<*recipient*@"+($($fields[7])))
  16. }
  17.  
  18. }
  19.  
  20. Measure-Command {
  21.  
  22. Get-Content $tempDir$todaysLog | Where-Object { $_ -match "" } |
  23. ForEach-Object -Process {
  24. $s2 = $_ -replace "t[^@t']+@", "`t*sender*@"
  25. $s3 = $s2 -replace "<['.+@", "<['*recipient*@"
  26. Add-Content -Path $importSource2$todaysLog -value $s3
  27. }
  28.  
  29. }
  30.  
  31. Measure-Command {
  32.  
  33. cat $tempDir$todaysLog |
  34. %{ [regex]::Replace($_, "[A-Z0-9._%+-]+(@[A-Z0-9.-]+.[A-Z]{2,4}s<[')[A-Z0-9._%+-]+(@[A-Z0-9.-]+.[A-Z]{2,4}']>)", '*sender*$1*recipients*$2', "IgnoreCase") } > $importSource2$todaysLog
  35.  
  36. }
  37.  
  38. $s1 = "10.197.71.28 SG 02012009 00:00:00 sender@kpmg.com <['recip@kpmg.com.sg']>"
  39. $s2 = $s1 -replace "t[^@t']+@", "`t*sender*@"
  40. $s3 = $s2 -replace "<['.+@", "<['*recipient*@"
  41. write-host $s3
Add Comment
Please, Sign In to add comment