i need to redirect a output of a command to two files say file1 and file2 file1 is a new file and file2 is already existing file where i need to append the output i have tried
This is not giving the expected results:
command > file1 > file2
i need to redirect a output of a command to two files say file1 and file2 file1 is a new file and file2 is already existing file where i need to append the output i have tried
This is not giving the expected results:
command > file1 > file2
You are looking for the
tee
command.Assuming you're on a Linux-like system, try
tee
splits the output stream and sends it to two destinations.For Windows (cmd.exe):
In Linux, you can do this
command | tee file1 >> file2
It will be possible using the following command. command | tee -a file1 file2
In PowerShell use
tee-object
(or itstee
alias)Can also tee to a variable (e.g. for further processing).