Hi guys. I've a txt file like this
line1
line2
...
line n
and so on
I need to create a new file adding an empty line every two rows
line1
line2
line3
line4
line5
I wrote this code:
$i=0; gc myfile.txt | % {$i=$i++; if($i%2 -eq 0) {add-content newfile.txt $_} else {add-content newfile.txt `n,$_}}
but the file remains the same. Where's my mistake? Thanks in advance.