How to add to a pipeline in powershell? -


let's have 2 files f1.txt , f2.txt. f1.txt has corrections need made, after both files need processed together. how merge output of f1.txt corrections pipeline f2.txt data? here illustration:

get-content f1.txt | % {     $_ #some operation }    # how merge output next pipeline? get-content f2.txt | % {     #combined operations on f1.txt output , f2.txt } > output.txt 

edit: understand can save first operation temporary file , read again combined operation:

... } > temp.txt get-content temp.txt, f2.txt | ... 

but there way without creating buffer files?

you can wrap multiple commands in single sciptblock , invoke it:

& {     get-content f1.txt |     % {         $_ #some operation     }     get-content f2.txt } | % {     #combined operations on f1.txt output , f2.txt } > output.txt 

Comments