I have a text file with Names and a textfile with names and numbers it looks like this:
a.txt:
Anna
Edward
Markus
Jenny
Jens
b.txt:
23434Anna
65790569Edward
4343Johann
2432343Hannah
2458435Jens
So this is only a example. List a is like 500 lines and list b 2000.
So what i want to do is compare the two lists and everytime a line of "b.txt" contains a line from "a.txt" (like "Anna" is in "23434Anna") i want to replace the line in "b.txt" with the line of "a.txt". So this line should be changed to just "Anna".
i tried stuff like
ForEach($a in $b) {$a -replace $b}
So i know this is kinda nonense but i want to make clear what i am trien to do. I need ofc a way to seperate the specific lines to unique objects. I know that can be done throug indexing... But i am not sure how to loop through the index of a variable.
Greetings