I need a Powershell script which reads a given file for any occurrence of the keywords "Match: " and "Replace: " and copy the line in front of it to a new line in another text file separated and ended by pipe. Example below.
Input
20/01/2016 00:00:18 Some Lines of Text here
20/01/2016 00:00:18 Some Lines of Text here
20/01/2016 00:00:18 Match: /test/OLD/Myfolders/Folders/Folder1/
20/01/2016 00:00:19 Replace: /test2/NEW/currentfiles/
20/01/2016 00:00:19 Some Lines of Text here
20/01/2016 00:00:20 Some Lines of Text here
20/01/2016 00:00:20 Some Lines of Text here
20/01/2016 00:00:20 Match: /match/2015/pages/
20/01/2016 00:00:20 Replace: /replace/2016/pages/
20/01/2016 00:00:21 Some Lines of Text here
Output
/test/OLD/Myfolders/Folders/Folder1/|/test2/NEW/currentfiles/|
/match/2015/pages/|/replace/2016/pages/|
so every time the keyword "Match: " is found the URL in front of it is copied to a new line in the new text file followed by pipe and the URL in front of "Replace: "
/Matching URL/|/Replacing URL/|
/Matching URL/|/Replacing URL/|