Powershell Prepend Header File to Huge Non-csv Data File Without Creating 3rd File

40 views Asked by At

I have a 2GB pipe-delimited data file. I would like to use PowerShell to prepend a header to the file without creating a third file. Looking at this link, I would like to change

Get-Content inputFile1.txt, inputFile2.txt | Set-Content joinedFile.txt

to

Get-Content inputFile1.txt, inputFile2.txt | Set-Content inputFile2.txt

without creating a third file. What's the best way?

I see that it seems simple to capture data from many files into a new one. Is there a efficient way to combine files in some other way - perhaps by editing the text of the large file instead?

0

There are 0 answers