Good evening,
I plan to create a script to go to a folder where several txts-filled with data like this:
YYYYY | BBBBB | 11111 | blue | cccccc |
XXXXX | YYYYY | 11111 | AAA@gmail.com | BBBBB |
ZZZZZ | CCCCC | 11111 | yellow | DDDDD |
.
.
.
YYYYY | BBBBB | 22222 | blue | cccccc |
XXXXX | YYYYY | 22222 | AAA@hotmail.com | BBBBB |
ZZZZZ | CCCCC | 22222 | yellow | DDDDD |
.
.
.
YYYYY | BBBBB | 33333 | blue | cccccc |
XXXXX | YYYYY | 33333 | AAA@sapo.pt | BBBBB |
ZZZZZ | CCCCC | 33333 | yellow | DDDDD |
The goal is to seek the line where it appears the mail and pass not only the line but also the lines that have the same numeric field to another txt or csv.
So far I can find the mail and passes it to a csv but I could also bring the lines with the numerical value equal to that of the mail line.
get-childitem C: \ Usersxxxxx \ Desktop \ NEW \ * -include * .txt -recurse | select-string -pattern “@” | Export-Csv -path C: \ Users \ xxxxxx \ Desktop \ NEW \ dados.csv
Can you help me?
Thank you.