daveTechSearch
asked on
Powershell: Match array strings (from 2 txt files) line for line
I am trying to figure out how to join strings from two arrays (line for line).
Overview:
I need to run a third party app against a set of files. The output file generated by the 3rd party app (different file format) needs to be delivered to the same directory as the source file.
EXAMPLE:
I have generated the required files:
$sourceFiles = c:\temp\sFiles.txt
$sourceDirs = c:\temp\sDirs.txt
# each line in both arrays need to be matched one for one
For instance:
sourceFiles.txt would contain:
c:\one\please.log
c:\one\two\help.log
c:\one\two\help2.log
c:\one\three\me.log
sourceFolders.txt would contain:
c:\one
c:\one\two
c:\one\two
c:\one\three
As stated, I need to match the two line for line (up to 10000 lines)...SO
I need to be able to loop through the arrays run the app something like this:
& 'c:\program files\3rdPartyApp\App.exe' $sourceFile $sourceDir
OR
& 'c:\program files\3rdPartyApp\App.exe' c:\one\please.log c:\one\two
.... and so on.
Not sure if this is possible?
Overview:
I need to run a third party app against a set of files. The output file generated by the 3rd party app (different file format) needs to be delivered to the same directory as the source file.
EXAMPLE:
I have generated the required files:
$sourceFiles = c:\temp\sFiles.txt
$sourceDirs = c:\temp\sDirs.txt
# each line in both arrays need to be matched one for one
For instance:
sourceFiles.txt would contain:
c:\one\please.log
c:\one\two\help.log
c:\one\two\help2.log
c:\one\three\me.log
sourceFolders.txt would contain:
c:\one
c:\one\two
c:\one\two
c:\one\three
As stated, I need to match the two line for line (up to 10000 lines)...SO
I need to be able to loop through the arrays run the app something like this:
& 'c:\program files\3rdPartyApp\App.exe'
OR
& 'c:\program files\3rdPartyApp\App.exe'
.... and so on.
Not sure if this is possible?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
should that increment to the next line?... I am seeing it only increment to the next character on the first line
'c', ':', and '\'
'c', ':', and '\'
ASKER
Got it to work, with a little bit of rework... Thanks for your help!
Open in new window