Assuming you have a input file in.txt with following lines:
a b c
and you'd like to concatenate these 3 lines into a single line to a file out.txt i.e.
You can use the following PowerShell command:
-join (cat in.txt) | out-file out.txt
cat in.txt is executed first and returned the content of in.txt as an array of strings. The
-join cmdlet then joins the lines together into a single line, which is then piped (
|) into the
out-file cmdlet to produce the out.txt file.