I have 2 files: One contains email addresses, and the second contains email addresses, as well as additional text in each line containing the email addresses.
I am trying to use the first file (list of email addresses) as an array input to search the second file and return each line containing the addresses from the first file ( need the additional info that is in each line that contains an email address from the first file).
I'm pulling my hair out here!
Thanks,
UriahHeep
show sample files.
$emailsList = get-content .\emails.txt
$targetFile = get-content .\garbage.txt
$rowIndex=0
foreach ($row in $targetFile){
++$rowIndex
foreach ($email in $emailsList){
if ($row.tolower().contains($email.trim().tolower())){
"Row $rowIndex`: $row"
}
How correctly to format a code at a forum? Why at me it so awfully looks?
Many thanks Bush! This worked perfectly, and I learned a new trick!
Have a great weekend!
One option is to use an Editor that can format your code as HTML (PowerShellPlus can do this for you). And then use the HTML button on the toolbar above to insert the HTML proper.