I have a file like this
DeviceID : 3
FriendlyName : SAMSUNG MZVLW1T0HMLH-000H1
DeviceID : 0
FriendlyName : SAMSUNG MZNLN256HAJQ-000H7
DeviceID : 1
FriendlyName : ST1000LM049-2GH172
And I have other file like this
DAY JUNE1=3
DAY JUNE2=0
DAY JUNE3=1
I want to apend second file to first file, to be like this
JUNE1
DeviceID : 3
FriendlyName : SAMSUNG MZVLW1T0HMLH-000H1
JUNE2
DeviceID : 0
FriendlyName : SAMSUNG MZNLN256HAJQ-000H7
JUNE3
DeviceID : 1
FriendlyName : ST1000LM049-2GH172
I tried this
$file1 = Get-Content .\file1
$file2 = Get-Content .\file2
$output = $file, $file2 | Out-File .\outputfile.txt
my result is like this
DAY JUNE1=3
DAY JUNE2=0
DAY JUNE3=1
DeviceID : 3
FriendlyName : SAMSUNG MZVLW1T0HMLH-000H1
DeviceID : 0
FriendlyName : SAMSUNG MZNLN256HAJQ-000H7
DeviceID : 1
FriendlyName : ST1000LM049-2GH172
My expectation, I can create a new file with my expectation output like I mentioned above. Please help any idea
Updated
I tried this
$file1 = Get-Content .\file1
$file2 = Get-Content .\file2
$i=1
$arr=@()
Foreach($item in $file1)
{
$str= 'JUNE'+ $i + '=' + $item
$arr += $str
$i=$i+1
}
$arr | out-file Output.txt
It return me like this
JUNE1=
JUNE2=
JUNE3=DeviceID : 0
JUNE5=FriendlyName : INTEL SSDSC2BF180A4H SED
JUNE6=
JUNE7=DeviceID : 1
JUNE8=FriendlyName : INTEL SSDSC2BF180A4H
JUNE9=
JUNE10=DeviceID : 2
JUNE11=FriendlyName : TOSHIBA DT01ACA100
JUNE12=
JUNE13=
JUNE14=
ConvertFrom-StringData.$i = 0 $file2[$i] + "rn" + $file1[$i] + "rn" + $file1[$i + 1] $i++Its not a solution, but might be on the right direction