Powershell - easy question.
I want to concatenate N text files and prepend filename to each line. How to do same but have full path+filename? Each files should retain all text and line terminators as-is.
data1.txt
this is the text in
data1 file - hello
data2.txt
four score and
seven years ago
To get this file
output.txt
data1.txt: this is the text in
data1.txt: data1 file - hello
data2.txt: four score and
data2.txt: seven years ago
It will be something like this - but that actually works.
get-content c:\temp\data*.txt|foreach-object{$tmp=get-content $;$.basename+","+$tmp} > output.txt
Thanks